26 , mTextEdit( nullptr )
27 , mPlainTextEdit( nullptr )
28 , mLineEdit( nullptr )
38 if (
config(
"UseHtml" ).toBool() )
55 v = mLineEdit->
text();
68 if (
field().convertCompatible( res ) )
72 else if (
field().type() == QVariant::String &&
field().length() > 0 )
86 if (
config(
"IsMultiline" ).toBool() )
88 if (
config(
"UseHtml" ).toBool() )
105 mTextEdit = qobject_cast<
QTextEdit*>( editor );
107 mLineEdit = qobject_cast<
QLineEdit*>( editor );
112 if ( mPlainTextEdit )
128 mPlaceholderText = defVal.
toString();
129 mLineEdit->setPlaceholderText( mPlaceholderText );
139 mWritablePalette = mLineEdit->palette();
140 mReadOnlyPalette = mLineEdit->palette();
141 mReadOnlyPalette.
setColor( QPalette::Text, mWritablePalette.
color( QPalette::Disabled, QPalette::Text ) );
147 return mLineEdit || mTextEdit || mPlainTextEdit;
155 if ( mPlainTextEdit )
165 setWidgetValue(
QString(
"" ) );
169 if ( mPlainTextEdit )
182 setWidgetValue( val );
190 if ( mPlainTextEdit )
203 void QgsTextEditWrapper::textChanged(
const QString& )
212 void QgsTextEditWrapper::setWidgetValue(
const QVariant& val )
217 if ( !(
field().type() == QVariant::Int ||
field().type() == QVariant::Double ||
field().type() == QVariant::LongLong ||
field().type() == QVariant::Date ) )
225 if ( val !=
value() )
227 if (
config(
"UseHtml" ).toBool() )
234 if ( mPlainTextEdit )
236 if ( val !=
value() )
void setEnabled(bool enabled) override
void setColor(ColorGroup group, ColorRole role, const QColor &color)
const QColor & color(ColorGroup group, ColorRole role) const
QString toPlainText() const
void showIndeterminateState() override
Sets the widget to display in an indeterminate "mixed value" state.
QVariant value() const override
Will be used to access the widget's value.
void initWidget(QWidget *editor) override
This method should initialize the editor widget with runtime data.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
void setPlaceholderText(const QString &)
bool blockSignals(bool block)
QgsTextEditWrapper(QgsVectorLayer *vl, int fieldIdx, QWidget *editor=nullptr, QWidget *parent=nullptr)
bool valid() const override
Return true if the widget has been properly initialized.
QWidget * createWidget(QWidget *parent) override
This method should create a new widget with the provided parent.
QVariant value(const QString &key, const QVariant &defaultValue) const
void setReadOnly(bool ro)
void setValue(const QVariant &value) override
QString left(int n) const
void setReadOnly(bool ro)
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QString toPlainText() const
Represents a vector layer which manages a vector based data sets.
QVariant::Type type() const
Gets variant type of the field as it will be retrieved from data source.