30 mNofColumns->setMinimum( 1 );
31 mNofColumns->setMaximum( 10 );
32 mNofColumns->setValue( 1 );
42 connect( mAllowMulti, &QAbstractButton::toggled,
this, [ = ](
bool checked )
44 label_nofColumns->setEnabled( checked );
45 mNofColumns->setEnabled( checked );
56 cfg.insert( QStringLiteral(
"Layer" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->id() : QString() );
57 cfg.insert( QStringLiteral(
"Key" ), mKeyColumn->currentField() );
58 cfg.insert( QStringLiteral(
"Value" ), mValueColumn->currentField() );
59 cfg.insert( QStringLiteral(
"AllowMulti" ), mAllowMulti->isChecked() );
60 cfg.insert( QStringLiteral(
"NofColumns" ), mNofColumns->value() );
61 cfg.insert( QStringLiteral(
"AllowNull" ), mAllowNull->isChecked() );
62 cfg.insert( QStringLiteral(
"OrderByValue" ), mOrderByValue->isChecked() );
63 cfg.insert( QStringLiteral(
"FilterExpression" ), mFilterExpression->toPlainText() );
64 cfg.insert( QStringLiteral(
"UseCompleter" ), mUseCompleter->isChecked() );
72 mLayerName->setLayer( lyr );
73 mKeyColumn->setField( config.value( QStringLiteral(
"Key" ) ).toString() );
74 mValueColumn->setField( config.value( QStringLiteral(
"Value" ) ).toString() );
75 mAllowMulti->setChecked( config.value( QStringLiteral(
"AllowMulti" ) ).toBool() );
76 mNofColumns->setValue( config.value( QStringLiteral(
"NofColumns" ), 1 ).toInt() );
77 if ( !mAllowMulti->isChecked() )
79 label_nofColumns->setEnabled(
false );
80 mNofColumns->setEnabled(
false );
82 mAllowNull->setChecked( config.value( QStringLiteral(
"AllowNull" ) ).toBool() );
83 mOrderByValue->setChecked( config.value( QStringLiteral(
"OrderByValue" ) ).toBool() );
84 mFilterExpression->setPlainText( config.value( QStringLiteral(
"FilterExpression" ) ).toString() );
85 mUseCompleter->setChecked( config.value( QStringLiteral(
"UseCompleter" ) ).toBool() );
98 dlg.setWindowTitle( tr(
"Edit Filter Expression" ) );
100 if ( dlg.exec() == QDialog::Accepted )
102 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 QgsExpressionContextScope * formScope(const QgsFeature &formFeature=QgsFeature())
Creates a new scope which contains functions and variables from the current attribute form/table feat...
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.