18 #include <QPushButton> 44 return QVariant(
field().type() );
48 return mLineEdit->text();
52 return QVariant(
field().type() );
75 return mLineEdit || mLabel || mQgsWidget;
100 if ( dvcString.compare( QLatin1String(
"image" ), Qt::CaseInsensitive ) == 0 )
104 else if ( dvcString.compare( QLatin1String(
"web" ), Qt::CaseInsensitive ) == 0 )
127 mLineEdit = qobject_cast<QLineEdit *>( editor );
128 mLabel = qobject_cast<QLabel *>( editor );
140 mLineEdit = editor->findChild<QLineEdit *>();
146 QVariantMap cfg =
config();
148 if ( cfg.contains( QStringLiteral(
"UseLink" ) ) )
150 mQgsWidget->fileWidget()->setUseLink( cfg.value( QStringLiteral(
"UseLink" ) ).toBool() );
152 if ( cfg.contains( QStringLiteral(
"FullUrl" ) ) )
154 mQgsWidget->fileWidget()->setFullUrl( cfg.value( QStringLiteral(
"FullUrl" ) ).toBool() );
160 mQgsWidget->setDefaultRoot( cfg.value( QStringLiteral(
"DefaultRoot" ) ).toString() );
162 if ( cfg.contains( QStringLiteral(
"StorageMode" ) ) )
164 mQgsWidget->fileWidget()->setStorageMode( (
QgsFileWidget::StorageMode )cfg.value( QStringLiteral(
"StorageMode" ) ).toInt() );
166 if ( cfg.contains( QStringLiteral(
"RelativeStorage" ) ) )
170 if ( cfg.contains( QStringLiteral(
"FileWidget" ) ) )
172 mQgsWidget->setFileWidgetVisible( cfg.value( QStringLiteral(
"FileWidget" ) ).toBool() );
174 if ( cfg.contains( QStringLiteral(
"FileWidgetButton" ) ) )
176 mQgsWidget->fileWidget()->setFileWidgetButtonVisible( cfg.value( QStringLiteral(
"FileWidgetButton" ) ).toBool() );
178 if ( cfg.contains( QStringLiteral(
"DocumentViewer" ) ) )
182 if ( cfg.contains( QStringLiteral(
"FileWidgetFilter" ) ) )
184 mQgsWidget->fileWidget()->setFilter( cfg.value( QStringLiteral(
"FileWidgetFilter" ) ).toString() );
189 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString &
value ) { emit
valueChanged( value ); } );
197 if ( value.isNull() )
203 mLineEdit->setText( value.toString() );
209 mLabel->setText( value.toString() );
215 if ( value.isNull() )
230 mLineEdit->setReadOnly( !enabled );
236 void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
242 widget()->setStyleSheet( QString() );
249 mLineEdit->setStyleSheet( QString() );
253 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #dd7777; }" ) );
257 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #ffd85d; }" ) );
QString valueAsString(int key, const QgsExpressionContext &context, const QString &defaultString=QString(), bool *ok=nullptr) const
Calculates the current value of the property with the specified key and interprets it as a string...
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool loadVariant(const QVariant &configuration, const QgsPropertiesDefinition &definitions) override
Loads this property collection from a QVariantMap, wrapped in a QVariant.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
bool hasActiveProperties() const override
Returns true if the collection has any active properties, or false if all properties within the colle...
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
Represents a vector layer which manages a vector based data sets.