QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
qgsexternalresourcewidgetwrapper.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsexternalresourcewidgetwrapper.cpp
3  --------------------------------------
4  begin : 16.12.2015
5  copyright : (C) 2015 by Denis Rouzaud
6  email : [email protected]
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
17 
18 #include <QPushButton>
19 #include <QSettings>
20 #include <QLabel>
21 
22 #include "qgsproject.h"
24 #include "qgsfilterlineedit.h"
25 #include "qgsapplication.h"
28 
29 
30 QgsExternalResourceWidgetWrapper::QgsExternalResourceWidgetWrapper( QgsVectorLayer *layer, int fieldIdx, QWidget *editor, QgsMessageBar *messageBar, QWidget *parent )
31  : QgsEditorWidgetWrapper( layer, fieldIdx, editor, parent )
32  , mMessageBar( messageBar )
33 {
34 }
35 
37 {
38  if ( mQgsWidget )
39  {
40  return mQgsWidget->documentPath( field().type() );
41  }
42 
43  if ( mLineEdit )
44  {
45  if ( mLineEdit->text().isEmpty() || mLineEdit->text() == QgsApplication::nullRepresentation() )
46  {
47  return QVariant( field().type() );
48  }
49  else
50  {
51  return mLineEdit->text();
52  }
53  }
54 
55  return QVariant( field().type() );
56 }
57 
59 {
60  if ( mLineEdit )
61  {
62  whileBlocking( mLineEdit )->clear();
63  }
64 
65  if ( mLabel )
66  {
67  mLabel->clear();
68  }
69 
70  if ( mQgsWidget )
71  {
72  whileBlocking( mQgsWidget )->setDocumentPath( QString() );
73  }
74 }
75 
77 {
78  return mLineEdit || mLabel || mQgsWidget;
79 }
80 
81 void QgsExternalResourceWidgetWrapper::updateProperties( const QgsFeature &feature )
82 {
83  if ( mQgsWidget && mPropertyCollection.hasActiveProperties() )
84  {
86  expressionContext.setFeature( feature );
87  bool ok = false;
88 
90  {
91  const QString path = mPropertyCollection.valueAsString( QgsEditorWidgetWrapper::RootPath, expressionContext, QString(), &ok );
92  if ( ok )
93  {
94  mQgsWidget->setDefaultRoot( path );
95  }
96  }
98  {
99  const QString dvcString = mPropertyCollection.valueAsString( QgsEditorWidgetWrapper::DocumentViewerContent, expressionContext, QStringLiteral( "NoContent" ), &ok );
100  if ( ok )
101  {
103  if ( dvcString.compare( QLatin1String( "image" ), Qt::CaseInsensitive ) == 0 )
104  {
106  }
107  else if ( dvcString.compare( QLatin1String( "web" ), Qt::CaseInsensitive ) == 0 )
108  {
110  }
111  else
112  {
114  }
115  mQgsWidget->setDocumentViewerContent( dvc );
116  }
117  }
118  }
119 }
120 
122 {
123  updateProperties( feature );
125 
126  if ( mQgsWidget )
127  {
129  }
130 }
131 
133 {
134  mForm = qobject_cast<QgsAttributeForm *>( parent );
135 
136  if ( mForm )
138 
139  return new QgsExternalResourceWidget( parent );
140 }
141 
143 {
144  mLineEdit = qobject_cast<QLineEdit *>( editor );
145  mLabel = qobject_cast<QLabel *>( editor );
146  mQgsWidget = qobject_cast<QgsExternalResourceWidget *>( editor );
147 
148  if ( mLineEdit )
149  {
150  QgsFilterLineEdit *fle = qobject_cast<QgsFilterLineEdit *>( editor );
151  if ( fle )
152  {
154  }
155  }
156  else
157  mLineEdit = editor->findChild<QLineEdit *>();
158 
159  if ( mQgsWidget )
160  {
161  mQgsWidget->setMessageBar( mMessageBar );
162 
164 
165  const QVariantMap cfg = config();
166  mPropertyCollection.loadVariant( cfg.value( QStringLiteral( "PropertyCollection" ) ), propertyDefinitions() );
167 
168  mQgsWidget->setStorageType( cfg.value( QStringLiteral( "StorageType" ) ).toString() );
169  mQgsWidget->setStorageAuthConfigId( cfg.value( QStringLiteral( "StorageAuthConfigId" ) ).toString() );
170 
173  QgsExpression::quotedValue( cfg.value( QStringLiteral( "StorageUrl" ) ).toString() ) );
174 
176 
177  if ( cfg.contains( QStringLiteral( "UseLink" ) ) )
178  {
179  mQgsWidget->fileWidget()->setUseLink( cfg.value( QStringLiteral( "UseLink" ) ).toBool() );
180  }
181  if ( cfg.contains( QStringLiteral( "FullUrl" ) ) )
182  {
183  mQgsWidget->fileWidget()->setFullUrl( cfg.value( QStringLiteral( "FullUrl" ) ).toBool() );
184  }
185 
187  {
188  mQgsWidget->setDefaultRoot( cfg.value( QStringLiteral( "DefaultRoot" ) ).toString() );
189  }
190  if ( cfg.contains( QStringLiteral( "StorageMode" ) ) )
191  {
192  mQgsWidget->fileWidget()->setStorageMode( ( QgsFileWidget::StorageMode )cfg.value( QStringLiteral( "StorageMode" ) ).toInt() );
193  }
194  if ( cfg.contains( QStringLiteral( "RelativeStorage" ) ) )
195  {
196  mQgsWidget->setRelativeStorage( ( QgsFileWidget::RelativeStorage )cfg.value( QStringLiteral( "RelativeStorage" ) ).toInt() );
197  }
198  if ( cfg.contains( QStringLiteral( "FileWidget" ) ) )
199  {
200  mQgsWidget->setFileWidgetVisible( cfg.value( QStringLiteral( "FileWidget" ) ).toBool() );
201  }
202  if ( cfg.contains( QStringLiteral( "FileWidgetButton" ) ) )
203  {
204  mQgsWidget->fileWidget()->setFileWidgetButtonVisible( cfg.value( QStringLiteral( "FileWidgetButton" ) ).toBool() );
205  }
206  if ( cfg.contains( QStringLiteral( "DocumentViewer" ) ) )
207  {
208  mQgsWidget->setDocumentViewerContent( ( QgsExternalResourceWidget::DocumentViewerContent )cfg.value( QStringLiteral( "DocumentViewer" ) ).toInt() );
209  }
210  if ( cfg.contains( QStringLiteral( "FileWidgetFilter" ) ) )
211  {
212  mQgsWidget->fileWidget()->setFilter( cfg.value( QStringLiteral( "FileWidgetFilter" ) ).toString() );
213  }
214  if ( cfg.contains( QStringLiteral( "DocumentViewerHeight" ) ) )
215  {
216  mQgsWidget->setDocumentViewerHeight( cfg.value( QStringLiteral( "DocumentViewerHeight" ) ).toInt( ) );
217  }
218  if ( cfg.contains( QStringLiteral( "DocumentViewerWidth" ) ) )
219  {
220  mQgsWidget->setDocumentViewerWidth( cfg.value( QStringLiteral( "DocumentViewerWidth" ) ).toInt( ) );
221  }
222  }
223 
224  if ( mLineEdit )
225  connect( mLineEdit, &QLineEdit::textChanged, this, [ = ]( const QString & value )
226  {
228  emit valueChanged( value );
230  emit valuesChanged( value );
231  } );
232 
233 }
234 
235 void QgsExternalResourceWidgetWrapper::updateValues( const QVariant &value, const QVariantList & )
236 {
237  if ( mLineEdit )
238  {
239  if ( value.isNull() )
240  {
241  mLineEdit->setText( QgsApplication::nullRepresentation() );
242  }
243  else
244  {
245  mLineEdit->setText( value.toString() );
246  }
247  }
248 
249  if ( mLabel )
250  {
251  mLabel->setText( value.toString() );
253  emit valueChanged( value.toString() );
255  emit valuesChanged( value.toString() ); // emit signal that value has changed, do not do it for other widgets
256  }
257 
258  if ( mQgsWidget )
259  {
260  if ( value.isNull() )
261  {
263  }
264  else
265  {
266  mQgsWidget->setDocumentPath( value.toString() );
267  }
268  }
269 }
270 
272 {
273  if ( mLineEdit )
274  mLineEdit->setReadOnly( !enabled );
275 
276  if ( mQgsWidget )
277  mQgsWidget->setReadOnly( !enabled );
278 }
279 
280 void QgsExternalResourceWidgetWrapper::widgetValueChanged( const QString &attribute, const QVariant &newValue, bool attributeChanged )
281 {
282  Q_UNUSED( newValue );
283  if ( attributeChanged )
284  {
287 
288  if ( documentViewerContentExp.referencedColumns().contains( attribute ) ||
289  rootPathExp.referencedColumns().contains( attribute ) )
290  {
291  const QgsFeature feature = mForm->currentFormFeature();
292  updateProperties( feature );
293  }
294  }
295 }
296 
297 void QgsExternalResourceWidgetWrapper::updateConstraintWidgetStatus()
298 {
299  if ( mLineEdit )
300  {
301  if ( !constraintResultVisible() )
302  {
303  widget()->setStyleSheet( QString() );
304  }
305  else
306  {
307  switch ( constraintResult() )
308  {
310  mLineEdit->setStyleSheet( QString() );
311  break;
312 
314  mLineEdit->setStyleSheet( QStringLiteral( "QgsFilterLineEdit { background-color: #dd7777; }" ) );
315  break;
316 
318  mLineEdit->setStyleSheet( QStringLiteral( "QgsFilterLineEdit { background-color: #ffd85d; }" ) );
319  break;
320  }
321  }
322  }
323 }
324 
326 {
327  if ( !mQgsWidget || !layer() )
328  return;
329 
330  QgsExpressionContext expressionContext( layer()->createExpressionContext() );
331  expressionContext.setFeature( formFeature() );
333  if ( context().parentFormFeature().isValid() )
334  {
335  expressionContext.appendScope( QgsExpressionContextUtils::parentFormScope( context().parentFormFeature() ) );
336  }
337 
338  mQgsWidget->fileWidget()->setExpressionContext( expressionContext );
339 }
QgsExternalResourceWidgetWrapper::initWidget
void initWidget(QWidget *editor) override
This method should initialize the editor widget with runtime data.
Definition: qgsexternalresourcewidgetwrapper.cpp:142
QgsExpressionContext
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
Definition: qgsexpressioncontext.h:406
qgsexpressioncontextutils.h
QgsExternalStorageFileWidget::setStorageUrlExpression
void setStorageUrlExpression(const QString &urlExpression)
Set urlExpression expression, which once evaluated, provide the URL used to store selected documents.
Definition: qgsexternalstoragefilewidget.cpp:112
QgsWidgetWrapper::DocumentViewerContent
@ DocumentViewerContent
Document type for external resource.
Definition: qgswidgetwrapper.h:79
QgsExternalResourceWidget::fileWidget
QgsExternalStorageFileWidget * fileWidget()
Returns file widget to allow its configuration.
Definition: qgsexternalresourcewidget.cpp:98
QgsExternalStorageFileWidget::setExpressionContext
void setExpressionContext(const QgsExpressionContext &context)
Set expression context to be used when for storage URL expression evaluation.
Definition: qgsexternalstoragefilewidget.cpp:128
QgsExternalResourceWidgetWrapper::valid
bool valid() const override
Returns true if the widget has been properly initialized.
Definition: qgsexternalresourcewidgetwrapper.cpp:76
QgsEditorWidgetWrapper::ConstraintResultFailHard
@ ConstraintResultFailHard
Widget failed at least one hard (enforced) constraint.
Definition: qgseditorwidgetwrapper.h:63
QgsExpression::referencedColumns
QSet< QString > referencedColumns() const
Gets list of columns referenced by the expression.
Definition: qgsexpression.cpp:221
QgsExpressionContextUtils::formScope
static QgsExpressionContextScope * formScope(const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString())
Creates a new scope which contains functions and variables from the current attribute form/table form...
Definition: qgsexpressioncontextutils.cpp:270
QgsExternalResourceWidgetWrapper::setFeature
void setFeature(const QgsFeature &feature) override
Definition: qgsexternalresourcewidgetwrapper.cpp:121
QgsExternalResourceWidget::setDefaultRoot
void setDefaultRoot(const QString &defaultRoot)
Configures the base path which should be used if the relativeStorage property is set to QgsFileWidget...
Definition: qgsexternalresourcewidget.cpp:221
QgsProperty::asExpression
QString asExpression() const
Returns an expression string representing the state of the property, or an empty string if the proper...
Definition: qgsproperty.cpp:398
qgsfilterlineedit.h
QgsFileWidget::GetFile
@ GetFile
Select a single file.
Definition: qgsfilewidget.h:68
QgsFilterLineEdit
QLineEdit subclass with built in support for clearing the widget's value and handling custom null val...
Definition: qgsfilterlineedit.h:39
QgsPropertyCollection::loadVariant
bool loadVariant(const QVariant &configuration, const QgsPropertiesDefinition &definitions) override
Loads this property collection from a QVariantMap, wrapped in a QVariant.
Definition: qgspropertycollection.cpp:341
QgsExternalResourceWidgetWrapper::createWidget
QWidget * createWidget(QWidget *parent) override
This method should create a new widget with the provided parent.
Definition: qgsexternalresourcewidgetwrapper.cpp:132
QgsExpressionContextUtils::globalProjectLayerScopes
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
Definition: qgsexpressioncontextutils.cpp:377
QgsExternalResourceWidgetWrapper::showIndeterminateState
void showIndeterminateState() override
Sets the widget to display in an indeterminate "mixed value" state.
Definition: qgsexternalresourcewidgetwrapper.cpp:58
QgsFileWidget::setFileWidgetButtonVisible
void setFileWidgetButtonVisible(bool visible)
Sets whether the tool button is visible.
Definition: qgsfilewidget.cpp:155
QgsWidgetWrapper::RootPath
@ RootPath
Root path for external resource.
Definition: qgswidgetwrapper.h:78
QgsExternalResourceWidget::setMessageBar
void setMessageBar(QgsMessageBar *messageBar)
Set messageBar to report messages.
Definition: qgsexternalresourcewidget.cpp:258
QgsWidgetWrapper::context
const QgsAttributeEditorContext & context() const
Returns information about the context in which this widget is shown.
Definition: qgswidgetwrapper.cpp:87
QgsEditorWidgetWrapper::constraintResultVisible
bool constraintResultVisible
Definition: qgseditorwidgetwrapper.h:51
qgsexternalresourcewidgetwrapper.h
QgsWidgetWrapper::widget
QWidget * widget()
Access the widget managed by this wrapper.
Definition: qgswidgetwrapper.cpp:47
QgsExternalResourceWidget
Widget to display file path with a push button for an "open file" dialog It can also be used to displ...
Definition: qgsexternalresourcewidget.h:52
QgsEditorWidgetWrapper
Manages an editor widget Widget and wrapper share the same parent.
Definition: qgseditorwidgetwrapper.h:47
QgsPropertyCollection::property
QgsProperty property(int key) const override
Returns a matching property from the collection, if one exists.
Definition: qgspropertycollection.cpp:214
QgsProperty::expressionString
QString expressionString() const
Returns the expression used for the property value.
Definition: qgsproperty.cpp:389
QgsExternalResourceWidget::NoContent
@ NoContent
Definition: qgsexternalresourcewidget.h:75
QgsExternalResourceWidget::DocumentViewerContent
DocumentViewerContent
Definition: qgsexternalresourcewidget.h:73
qgsapplication.h
QgsFileWidget::setUseLink
void setUseLink(bool useLink)
Sets whether the file path will be shown as a link.
Definition: qgsfilewidget.cpp:203
QgsExpression::quotedValue
static QString quotedValue(const QVariant &value)
Returns a string representation of a literal value, including appropriate quotations where required.
Definition: qgsexpression.cpp:82
QgsEditorWidgetWrapper::valueChanged
Q_DECL_DEPRECATED void valueChanged(const QVariant &value)
Emit this signal, whenever the value changed.
Q_NOWARN_DEPRECATED_POP
#define Q_NOWARN_DEPRECATED_POP
Definition: qgis.h:2820
QgsExternalResourceWidget::setReadOnly
void setReadOnly(bool readOnly)
defines if the widget is readonly
Definition: qgsexternalresourcewidget.cpp:149
QgsEditorWidgetWrapper::ConstraintResultPass
@ ConstraintResultPass
Widget passed constraints successfully.
Definition: qgseditorwidgetwrapper.h:62
QgsExternalResourceWidget::setRelativeStorage
void setRelativeStorage(QgsFileWidget::RelativeStorage relativeStorage)
Configures if paths are handled absolute or relative and if relative, which should be the base path.
Definition: qgsexternalresourcewidget.cpp:232
QgsExternalResourceWidget::setDocumentViewerWidth
void setDocumentViewerWidth(int width)
setDocumentViewerWidth set the width of the document viewer.
Definition: qgsexternalresourcewidget.cpp:143
QgsExternalResourceWidgetWrapper::QgsExternalResourceWidgetWrapper
QgsExternalResourceWidgetWrapper(QgsVectorLayer *layer, int fieldIdx, QWidget *editor=nullptr, QgsMessageBar *messageBar=nullptr, QWidget *parent=nullptr)
Constructor for QgsExternalResourceWidgetWrapper.
Definition: qgsexternalresourcewidgetwrapper.cpp:30
QgsExternalResourceWidget::documentPath
QVariant documentPath(QVariant::Type type=QVariant::String) const
documentPath returns the path of the current document in the widget
Definition: qgsexternalresourcewidget.cpp:80
QgsAttributeForm::currentFormFeature
QgsFeature currentFormFeature() const
Returns the feature that is currently displayed in the form with all the changes received on editing ...
Definition: qgsattributeform.h:84
QgsExternalResourceWidget::setStorageAuthConfigId
void setStorageAuthConfigId(const QString &authCfg)
Sets the authentication configuration ID to be used for the current external storage (if defined)
Definition: qgsexternalresourcewidget.cpp:248
QgsWidgetWrapper::layer
QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
Definition: qgswidgetwrapper.cpp:92
whileBlocking
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
Definition: qgis.h:2191
QgsExternalResourceWidget::setFileWidgetVisible
void setFileWidgetVisible(bool visible)
Sets the visibility of the file widget in the layout.
Definition: qgsexternalresourcewidget.cpp:108
QgsPropertyCollection::hasActiveProperties
bool hasActiveProperties() const override
Returns true if the collection has any active properties, or false if all properties within the colle...
Definition: qgspropertycollection.cpp:304
QgsWidgetWrapper::StorageUrl
@ StorageUrl
Storage URL for external resource.
Definition: qgswidgetwrapper.h:80
QgsApplication::nullRepresentation
static QString nullRepresentation()
This string is used to represent the value NULL throughout QGIS.
Definition: qgsapplication.cpp:2018
QgsExpressionContextUtils::parentFormScope
static QgsExpressionContextScope * parentFormScope(const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString())
Creates a new scope which contains functions and variables from the current parent attribute form/tab...
Definition: qgsexpressioncontextutils.cpp:281
qgsexternalresourcewidget.h
QgsMessageBar
A bar for displaying non-blocking messages to the user.
Definition: qgsmessagebar.h:60
QgsEditorWidgetWrapper::field
QgsField field() const
Access the field.
Definition: qgseditorwidgetwrapper.cpp:39
qgsexternalstoragefilewidget.h
QgsExternalResourceWidgetWrapper::value
QVariant value() const override
Will be used to access the widget's value.
Definition: qgsexternalresourcewidgetwrapper.cpp:36
QgsExternalResourceWidget::setDocumentViewerHeight
void setDocumentViewerHeight(int height)
setDocumentViewerWidth set the height of the document viewer.
Definition: qgsexternalresourcewidget.cpp:132
QgsExternalResourceWidgetWrapper::widgetValueChanged
void widgetValueChanged(const QString &attribute, const QVariant &newValue, bool attributeChanged)
Will be called when a value in the current edited form or table row changes.
Definition: qgsexternalresourcewidgetwrapper.cpp:280
QgsAbstractPropertyCollection::valueAsString
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.
Definition: qgspropertycollection.cpp:42
QgsFileWidget::RelativeStorage
RelativeStorage
The RelativeStorage enum determines if path is absolute, relative to the current project path or rela...
Definition: qgsfilewidget.h:78
QgsExpressionContext::appendScope
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
Definition: qgsexpressioncontext.cpp:494
QgsWidgetWrapper::propertyDefinitions
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the editor widget property definitions.
Definition: qgswidgetwrapper.cpp:22
QgsEditorWidgetWrapper::valuesChanged
void valuesChanged(const QVariant &value, const QVariantList &additionalFieldValues=QVariantList())
Emit this signal, whenever the value changed.
QgsWidgetWrapper::config
QVariantMap config() const
Returns the whole config.
Definition: qgswidgetwrapper.cpp:82
QgsExternalResourceWidget::Image
@ Image
Definition: qgsexternalresourcewidget.h:76
QgsVectorLayer
Represents a vector layer which manages a vector based data sets.
Definition: qgsvectorlayer.h:391
QgsExternalResourceWidget::Web
@ Web
Definition: qgsexternalresourcewidget.h:77
QgsFileWidget::StorageMode
StorageMode
The StorageMode enum determines if the file picker should pick files or directories.
Definition: qgsfilewidget.h:66
QgsEditorWidgetWrapper::ConstraintResultFailSoft
@ ConstraintResultFailSoft
Widget failed at least one soft (non-enforced) constraint.
Definition: qgseditorwidgetwrapper.h:64
QgsWidgetWrapper::mPropertyCollection
QgsPropertyCollection mPropertyCollection
Data defined property collection.
Definition: qgswidgetwrapper.h:246
QgsFileWidget::setStorageMode
void setStorageMode(QgsFileWidget::StorageMode storageMode)
Sets the widget's storage mode (i.e.
Definition: qgsfilewidget.cpp:237
QgsFileWidget::setFilter
void setFilter(const QString &filter)
setFilter sets the filter used by the model to filters.
Definition: qgsfilewidget.cpp:134
QgsExternalResourceWidget::setDocumentPath
void setDocumentPath(const QVariant &documentPath)
Definition: qgsexternalresourcewidget.cpp:93
QgsAttributeForm::widgetValueChanged
void widgetValueChanged(const QString &attribute, const QVariant &value, bool attributeChanged)
Notifies about changes of attributes.
QgsFilterLineEdit::setNullValue
void setNullValue(const QString &nullValue)
Sets the string representation for null values in the widget.
Definition: qgsfilterlineedit.h:115
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition: qgsfeature.h:55
QgsEditorWidgetWrapper::constraintResult
ConstraintResult constraintResult
Definition: qgseditorwidgetwrapper.h:52
QgsFileWidget::setFullUrl
void setFullUrl(bool fullUrl)
Sets whether links shown use the full path.
Definition: qgsfilewidget.cpp:217
QgsExternalResourceWidget::setDocumentViewerContent
void setDocumentViewerContent(QgsExternalResourceWidget::DocumentViewerContent content)
setDocumentViewerContent defines the type of content to be shown. Widget will be adapted accordingly
Definition: qgsexternalresourcewidget.cpp:119
QgsExternalResourceWidgetWrapper::setEnabled
void setEnabled(bool enabled) override
Definition: qgsexternalresourcewidgetwrapper.cpp:271
QgsExternalResourceWidgetWrapper::updateFileWidgetExpressionContext
void updateFileWidgetExpressionContext()
Update file widget current expression context according to layer, feature, and parent feature.
Definition: qgsexternalresourcewidgetwrapper.cpp:325
QgsExpression
Class for parsing and evaluation of expressions (formerly called "search strings")....
Definition: qgsexpression.h:102
QgsPropertyCollection::isActive
bool isActive(int key) const override
Returns true if the collection contains an active property with the specified key.
Definition: qgspropertycollection.cpp:268
QgsEditorWidgetWrapper::setFeature
void setFeature(const QgsFeature &feature) override
Will be called when the feature changes.
Definition: qgseditorwidgetwrapper.cpp:69
Q_NOWARN_DEPRECATED_PUSH
#define Q_NOWARN_DEPRECATED_PUSH
Definition: qgis.h:2819
QgsExternalResourceWidget::setStorageType
void setStorageType(const QString &storageType)
Set storageType storage type unique identifier as defined in QgsExternalStorageRegistry or null QStri...
Definition: qgsexternalresourcewidget.cpp:238
qgsproject.h
QgsExpressionContext::setFeature
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Definition: qgsexpressioncontext.cpp:525
QgsEditorWidgetWrapper::formFeature
QgsFeature formFeature() const
The feature currently being edited, in its current state.
Definition: qgseditorwidgetwrapper.h:346