18 #include <QPushButton> 46 return QVariant(
field().type() );
50 return mLineEdit->text();
54 return QVariant(
field().type() );
77 return mLineEdit || mLabel || mQgsWidget;
102 if ( dvcString.compare( QLatin1String(
"image" ), Qt::CaseInsensitive ) == 0 )
106 else if ( dvcString.compare( QLatin1String(
"web" ), Qt::CaseInsensitive ) == 0 )
129 mLineEdit = qobject_cast<QLineEdit *>( editor );
130 mLabel = qobject_cast<QLabel *>( editor );
142 mLineEdit = editor->findChild<QLineEdit *>();
148 QVariantMap cfg =
config();
150 if ( cfg.contains( QStringLiteral(
"UseLink" ) ) )
152 mQgsWidget->fileWidget()->setUseLink( cfg.value( QStringLiteral(
"UseLink" ) ).toBool() );
154 if ( cfg.contains( QStringLiteral(
"FullUrl" ) ) )
156 mQgsWidget->fileWidget()->setFullUrl( cfg.value( QStringLiteral(
"FullUrl" ) ).toBool() );
162 mQgsWidget->setDefaultRoot( cfg.value( QStringLiteral(
"DefaultRoot" ) ).toString() );
164 if ( cfg.contains( QStringLiteral(
"StorageMode" ) ) )
166 mQgsWidget->fileWidget()->setStorageMode( (
QgsFileWidget::StorageMode )cfg.value( QStringLiteral(
"StorageMode" ) ).toInt() );
168 if ( cfg.contains( QStringLiteral(
"RelativeStorage" ) ) )
172 if ( cfg.contains( QStringLiteral(
"FileWidget" ) ) )
174 mQgsWidget->setFileWidgetVisible( cfg.value( QStringLiteral(
"FileWidget" ) ).toBool() );
176 if ( cfg.contains( QStringLiteral(
"FileWidgetButton" ) ) )
178 mQgsWidget->fileWidget()->setFileWidgetButtonVisible( cfg.value( QStringLiteral(
"FileWidgetButton" ) ).toBool() );
180 if ( cfg.contains( QStringLiteral(
"DocumentViewer" ) ) )
184 if ( cfg.contains( QStringLiteral(
"FileWidgetFilter" ) ) )
186 mQgsWidget->fileWidget()->setFilter( cfg.value( QStringLiteral(
"FileWidgetFilter" ) ).toString() );
191 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString &
value )
201 void QgsExternalResourceWidgetWrapper::updateValues(
const QVariant &
value,
const QVariantList & )
205 if (
value.isNull() )
211 mLineEdit->setText(
value.toString() );
217 mLabel->setText(
value.toString() );
226 if (
value.isNull() )
241 mLineEdit->setReadOnly( !enabled );
247 void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
253 widget()->setStyleSheet( QString() );
260 mLineEdit->setStyleSheet( QString() );
264 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #dd7777; }" ) );
268 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #ffd85d; }" ) );
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
#define Q_NOWARN_DEPRECATED_PUSH
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.
#define Q_NOWARN_DEPRECATED_POP
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...
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.