QGIS API Documentation
3.14.0-Pi (9f7028fd23)
|
Go to the documentation of this file.
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 );
131 mQgsWidget = qobject_cast<QgsExternalResourceWidget *>( editor );
142 mLineEdit = editor->findChild<QLineEdit *>();
148 QVariantMap cfg =
config();
150 if ( cfg.contains( QStringLiteral(
"UseLink" ) ) )
154 if ( cfg.contains( QStringLiteral(
"FullUrl" ) ) )
162 mQgsWidget->
setDefaultRoot( cfg.value( QStringLiteral(
"DefaultRoot" ) ).toString() );
164 if ( cfg.contains( QStringLiteral(
"StorageMode" ) ) )
168 if ( cfg.contains( QStringLiteral(
"RelativeStorage" ) ) )
172 if ( cfg.contains( QStringLiteral(
"FileWidget" ) ) )
176 if ( cfg.contains( QStringLiteral(
"FileWidgetButton" ) ) )
180 if ( cfg.contains( QStringLiteral(
"DocumentViewer" ) ) )
184 if ( cfg.contains( QStringLiteral(
"FileWidgetFilter" ) ) )
186 mQgsWidget->
fileWidget()->
setFilter( cfg.value( QStringLiteral(
"FileWidgetFilter" ) ).toString() );
188 if ( cfg.contains( QStringLiteral(
"DocumentViewerHeight" ) ) )
192 if ( cfg.contains( QStringLiteral(
"DocumentViewerWidth" ) ) )
199 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString &
value )
209 void QgsExternalResourceWidgetWrapper::updateValues(
const QVariant &value,
const QVariantList & )
213 if (
value.isNull() )
219 mLineEdit->setText(
value.toString() );
225 mLabel->setText(
value.toString() );
234 if (
value.isNull() )
249 mLineEdit->setReadOnly( !enabled );
255 void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
261 widget()->setStyleSheet( QString() );
268 mLineEdit->setStyleSheet( QString() );
272 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #dd7777; }" ) );
276 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #ffd85d; }" ) );
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.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
#define Q_NOWARN_DEPRECATED_POP
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...
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
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 setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
#define Q_NOWARN_DEPRECATED_PUSH
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.