QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
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;
80 void QgsExternalResourceWidgetWrapper::updateProperties(
const QgsFeature &feature )
85 expressionContext.setFeature( feature );
102 if ( dvcString.compare( QLatin1String(
"image" ), Qt::CaseInsensitive ) == 0 )
106 else if ( dvcString.compare( QLatin1String(
"web" ), Qt::CaseInsensitive ) == 0 )
122 updateProperties( feature );
128 mForm = qobject_cast<QgsAttributeForm *>( parent );
138 mLineEdit = qobject_cast<QLineEdit *>( editor );
139 mLabel = qobject_cast<QLabel *>( editor );
140 mQgsWidget = qobject_cast<QgsExternalResourceWidget *>( editor );
151 mLineEdit = editor->findChild<QLineEdit *>();
157 QVariantMap cfg =
config();
159 if ( cfg.contains( QStringLiteral(
"UseLink" ) ) )
163 if ( cfg.contains( QStringLiteral(
"FullUrl" ) ) )
171 mQgsWidget->
setDefaultRoot( cfg.value( QStringLiteral(
"DefaultRoot" ) ).toString() );
173 if ( cfg.contains( QStringLiteral(
"StorageMode" ) ) )
177 if ( cfg.contains( QStringLiteral(
"RelativeStorage" ) ) )
181 if ( cfg.contains( QStringLiteral(
"FileWidget" ) ) )
185 if ( cfg.contains( QStringLiteral(
"FileWidgetButton" ) ) )
189 if ( cfg.contains( QStringLiteral(
"DocumentViewer" ) ) )
193 if ( cfg.contains( QStringLiteral(
"FileWidgetFilter" ) ) )
195 mQgsWidget->
fileWidget()->
setFilter( cfg.value( QStringLiteral(
"FileWidgetFilter" ) ).toString() );
197 if ( cfg.contains( QStringLiteral(
"DocumentViewerHeight" ) ) )
201 if ( cfg.contains( QStringLiteral(
"DocumentViewerWidth" ) ) )
208 connect( mLineEdit, &QLineEdit::textChanged,
this, [ = ](
const QString &
value )
218 void QgsExternalResourceWidgetWrapper::updateValues(
const QVariant &value,
const QVariantList & )
222 if (
value.isNull() )
228 mLineEdit->setText(
value.toString() );
234 mLabel->setText(
value.toString() );
243 if (
value.isNull() )
258 mLineEdit->setReadOnly( !enabled );
266 Q_UNUSED( newValue );
267 if ( attributeChanged )
276 updateProperties( feature );
281 void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
287 widget()->setStyleSheet( QString() );
294 mLineEdit->setStyleSheet( QString() );
298 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #dd7777; }" ) );
302 mLineEdit->setStyleSheet( QStringLiteral(
"QgsFilterLineEdit { background-color: #ffd85d; }" ) );
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QSet< QString > referencedColumns() const
Gets list of columns referenced by the expression.
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
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.
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
QString expressionString() const
Returns the expression used for the property value.
#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.
Represents a vector layer which manages a vector based data sets.
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Class for parsing and evaluation of expressions (formerly called "search strings").
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
#define Q_NOWARN_DEPRECATED_PUSH