44 cfg.insert( QStringLiteral(
"Layer" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->id() : QString() );
45 cfg.insert( QStringLiteral(
"Key" ), mKeyColumn->currentField() );
46 cfg.insert( QStringLiteral(
"Value" ), mValueColumn->currentField() );
47 cfg.insert( QStringLiteral(
"AllowMulti" ), mAllowMulti->isChecked() );
48 cfg.insert( QStringLiteral(
"AllowNull" ), mAllowNull->isChecked() );
49 cfg.insert( QStringLiteral(
"OrderByValue" ), mOrderByValue->isChecked() );
50 cfg.insert( QStringLiteral(
"FilterExpression" ), mFilterExpression->toPlainText() );
51 cfg.insert( QStringLiteral(
"UseCompleter" ), mUseCompleter->isChecked() );
59 mLayerName->setLayer( lyr );
60 mKeyColumn->setField( config.value( QStringLiteral(
"Key" ) ).toString() );
61 mValueColumn->setField( config.value( QStringLiteral(
"Value" ) ).toString() );
62 mAllowMulti->setChecked( config.value( QStringLiteral(
"AllowMulti" ) ).toBool() );
63 mAllowNull->setChecked( config.value( QStringLiteral(
"AllowNull" ) ).toBool() );
64 mOrderByValue->setChecked( config.value( QStringLiteral(
"OrderByValue" ) ).toBool() );
65 mFilterExpression->setPlainText( config.value( QStringLiteral(
"FilterExpression" ) ).toString() );
66 mUseCompleter->setChecked( config.value( QStringLiteral(
"UseCompleter" ) ).toBool() );
78 dlg.setWindowTitle( tr(
"Edit Filter Expression" ) );
80 if ( dlg.exec() == QDialog::Accepted )
82 mFilterExpression->setText( dlg.expressionBuilder()->expressionText() );
QVariantMap config() override
Create a configuration from the current GUI state.
void setConfig(const QVariantMap &config) override
Update the configuration widget to represent the given configuration.
void layerChanged(QgsMapLayer *layer)
layerChanged this signal is emitted whenever the currently selected layer changes ...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
void setLayer(QgsMapLayer *layer)
Sets the layer for which fields are listed in the combobox.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QgsMapLayer * mapLayer(const QString &layerId) const
Retrieve a pointer to a registered layer by layer ID.
QgsValueRelationConfigDlg(QgsVectorLayer *vl, int fieldIdx, QWidget *parent=nullptr)
Represents a vector layer which manages a vector based data sets.
A generic dialog for building expression strings.