32
32
#include < QSpinBox>
33
33
#include < QCompleter>
34
34
#include < QHBoxLayout>
35
-
36
- #if QT_VERSION >= 0x040400
37
35
#include < QPlainTextEdit>
38
- #endif
39
36
40
37
void QgsAttributeEditor::selectFileName ( void )
41
38
{
@@ -274,26 +271,17 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
274
271
{
275
272
QLineEdit *le = NULL ;
276
273
QTextEdit *te = NULL ;
277
- #if QT_VERSION >= 0x040400
278
274
QPlainTextEdit *pte = NULL ;
279
- #endif
280
275
281
276
if ( editor )
282
277
{
283
278
le = qobject_cast<QLineEdit *>( editor );
284
279
te = qobject_cast<QTextEdit *>( editor );
285
- #if QT_VERSION >= 0x040400
286
280
pte = qobject_cast<QPlainTextEdit *>( editor );
287
- #endif
288
281
}
289
282
else if ( editType == QgsVectorLayer::TextEdit )
290
283
{
291
- #if QT_VERSION >= 0x040400
292
284
pte = new QPlainTextEdit ( parent );
293
- #else
294
- te = new QTextEdit ( parent );
295
- te->setAcceptRichText ( false );
296
- #endif
297
285
}
298
286
else
299
287
{
@@ -331,18 +319,14 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
331
319
332
320
if ( te )
333
321
{
334
- #if QT_VERSION >= 0x040400
335
322
te->setAcceptRichText ( true );
336
- #endif
337
323
myWidget = te;
338
324
}
339
325
340
- #if QT_VERSION >= 0x040400
341
326
if ( pte )
342
327
{
343
328
myWidget = pte;
344
329
}
345
- #endif
346
330
}
347
331
break ;
348
332
@@ -424,19 +408,14 @@ bool QgsAttributeEditor::retrieveValue( QWidget *widget, QgsVectorLayer *vl, int
424
408
QTextEdit *te = qobject_cast<QTextEdit *>( widget );
425
409
if ( te )
426
410
{
427
- #if QT_VERSION >= 0x040400
428
411
text = te->toHtml ();
429
- #else
430
- text = te->toPlainText ();
431
- #endif
432
412
modified = te->document ()->isModified ();
433
413
if ( text == " NULL" )
434
414
{
435
415
text = QString::null;
436
416
}
437
417
}
438
418
439
- #if QT_VERSION >= 0x040400
440
419
QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( widget );
441
420
if ( pte )
442
421
{
@@ -447,7 +426,6 @@ bool QgsAttributeEditor::retrieveValue( QWidget *widget, QgsVectorLayer *vl, int
447
426
text = QString::null;
448
427
}
449
428
}
450
- #endif
451
429
452
430
QComboBox *cb = qobject_cast<QComboBox *>( widget );
453
431
if ( cb )
@@ -614,14 +592,9 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,
614
592
{
615
593
QLineEdit *le = qobject_cast<QLineEdit *>( editor );
616
594
QTextEdit *te = qobject_cast<QTextEdit *>( editor );
617
- #if QT_VERSION >= 0x040400
618
595
QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( editor );
619
596
if ( !le && !te && !pte )
620
597
return false ;
621
- #else
622
- if ( !le && !te )
623
- return false ;
624
- #endif
625
598
626
599
QString text;
627
600
if ( value.isNull () )
@@ -634,15 +607,10 @@ bool QgsAttributeEditor::setValue( QWidget *editor, QgsVectorLayer *vl, int idx,
634
607
635
608
if ( le )
636
609
le->setText ( text );
637
- #if QT_VERSION >= 0x040400
638
610
if ( te )
639
611
te->setHtml ( text );
640
612
if ( pte )
641
613
pte->setPlainText ( text );
642
- #else
643
- if ( te )
644
- te->setPlainText ( text );
645
- #endif
646
614
}
647
615
break ;
648
616
0 commit comments