27 , mPlainTextEdit( NULL )
38 if (
config(
"UseHtml" ).toBool() )
40 v = mTextEdit->toHtml();
44 v = mTextEdit->toPlainText();
50 v = mPlainTextEdit->toPlainText();
55 v = mLineEdit->text();
59 v == QSettings().value(
"qgis/nullValue",
"NULL" ).toString() )
63 if (
field().convertCompatible( res ) )
66 return QVariant(
field().type() );
71 if (
config(
"IsMultiline" ).toBool() )
73 if (
config(
"UseHtml" ).toBool() )
75 return new QTextEdit( parent );
79 return new QPlainTextEdit( parent );
90 mTextEdit = qobject_cast<QTextEdit*>( editor );
91 mPlainTextEdit = qobject_cast<QPlainTextEdit*>( editor );
92 mLineEdit = qobject_cast<QLineEdit*>( editor );
95 connect( mTextEdit, SIGNAL( textChanged() ),
this, SLOT(
valueChanged() ) );
98 connect( mPlainTextEdit, SIGNAL( textChanged() ),
this, SLOT(
valueChanged() ) );
107 mLineEdit->setPlaceholderText( QSettings().
value(
"qgis/nullValue",
"NULL" ).toString() );
114 connect( mLineEdit, SIGNAL( textChanged( QString ) ),
this, SLOT(
valueChanged( QString ) ) );
116 mWritablePalette = mLineEdit->palette();
117 mReadOnlyPalette = mLineEdit->palette();
118 mReadOnlyPalette.setColor( QPalette::Text, mWritablePalette.color( QPalette::Disabled, QPalette::Text ) );
125 if ( value.isNull() )
127 if ( !(
field().type() == QVariant::Int ||
field().type() == QVariant::Double ||
field().type() == QVariant::LongLong ||
field().type() == QVariant::Date ) )
128 v = QSettings().value(
"qgis/nullValue",
"NULL" ).toString();
131 v = value.toString();
135 if (
config(
"UseHtml" ).toBool() )
136 mTextEdit->setHtml( v );
138 mTextEdit->setPlainText( v );
141 if ( mPlainTextEdit )
142 mPlainTextEdit->setPlainText( v );
145 mLineEdit->setText( v );
151 mTextEdit->setReadOnly( !enabled );
153 if ( mPlainTextEdit )
154 mPlainTextEdit->setReadOnly( !enabled );
158 mLineEdit->setReadOnly( !enabled );
160 mLineEdit->setPalette( mWritablePalette );
162 mLineEdit->setPalette( mReadOnlyPalette );