29 mKeyColumn->setLayer( mLayerName->currentLayer() );
30 mValueColumn->setLayer( mLayerName->currentLayer() );
31 mGroupColumn->setLayer( mLayerName->currentLayer() );
32 mGroupColumn->setAllowEmptyFieldName(
true );
33 mDescriptionExpression->setLayer( mLayerName->currentLayer() );
41 mNofColumns->setMinimum( 1 );
42 mNofColumns->setMaximum( 10 );
43 mNofColumns->setValue( 1 );
48 connect( mGroupColumn,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [ = ](
int index )
50 mDisplayGroupName->setEnabled( index != 0 );
59 connect( mAllowMulti, &QAbstractButton::toggled,
this, [ = ](
bool checked )
61 label_nofColumns->setEnabled( checked );
62 mNofColumns->setEnabled( checked );
65 connect( mUseCompleter, &QCheckBox::stateChanged,
this, [ = ](
int state )
67 mCompleterMatchFromStart->setEnabled(
static_cast<Qt::CheckState
>( state ) == Qt::CheckState::Checked );
70 mCompleterMatchFromStart->setEnabled( mUseCompleter->isChecked() );
81 cfg.insert( QStringLiteral(
"Layer" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->id() : QString() );
82 cfg.insert( QStringLiteral(
"LayerName" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->name() : QString() );
83 cfg.insert( QStringLiteral(
"LayerSource" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->publicSource() : QString() );
84 cfg.insert( QStringLiteral(
"LayerProviderName" ), ( mLayerName->currentLayer() && mLayerName->currentLayer()->dataProvider() ) ?
85 mLayerName->currentLayer()->providerType() :
87 cfg.insert( QStringLiteral(
"Key" ), mKeyColumn->currentField() );
88 cfg.insert( QStringLiteral(
"Value" ), mValueColumn->currentField() );
89 cfg.insert( QStringLiteral(
"Group" ), mGroupColumn->currentField() );
90 cfg.insert( QStringLiteral(
"DisplayGroupName" ), mDisplayGroupName->isChecked() );
91 cfg.insert( QStringLiteral(
"Description" ), mDescriptionExpression->expression() );
92 cfg.insert( QStringLiteral(
"AllowMulti" ), mAllowMulti->isChecked() );
93 cfg.insert( QStringLiteral(
"NofColumns" ), mNofColumns->value() );
94 cfg.insert( QStringLiteral(
"AllowNull" ), mAllowNull->isChecked() );
95 cfg.insert( QStringLiteral(
"OrderByValue" ), mOrderByValue->isChecked() );
96 cfg.insert( QStringLiteral(
"FilterExpression" ), mFilterExpression->toPlainText() );
97 cfg.insert( QStringLiteral(
"UseCompleter" ), mUseCompleter->isChecked() );
98 const Qt::MatchFlags completerMatchFlags { mCompleterMatchFromStart->isChecked() ? Qt::MatchFlag::MatchStartsWith : Qt::MatchFlag::MatchContains };
99 cfg.insert( QStringLiteral(
"CompleterMatchFlags" ),
static_cast<int>( completerMatchFlags ) );
107 mLayerName->setLayer( lyr );
108 mKeyColumn->setField(
config.value( QStringLiteral(
"Key" ) ).toString() );
109 mValueColumn->setField(
config.value( QStringLiteral(
"Value" ) ).toString() );
110 mGroupColumn->setField(
config.value( QStringLiteral(
"Group" ) ).toString() );
111 mDisplayGroupName->setChecked(
config.value( QStringLiteral(
"DisplayGroupName" ) ).toBool() );
112 mDescriptionExpression->setField(
config.value( QStringLiteral(
"Description" ) ).toString() );
113 mAllowMulti->setChecked(
config.value( QStringLiteral(
"AllowMulti" ) ).toBool() );
114 mNofColumns->setValue(
config.value( QStringLiteral(
"NofColumns" ), 1 ).toInt() );
115 if ( !mAllowMulti->isChecked() )
117 label_nofColumns->setEnabled(
false );
118 mNofColumns->setEnabled(
false );
120 mAllowNull->setChecked(
config.value( QStringLiteral(
"AllowNull" ) ).toBool() );
121 mOrderByValue->setChecked(
config.value( QStringLiteral(
"OrderByValue" ) ).toBool() );
122 mFilterExpression->setPlainText(
config.value( QStringLiteral(
"FilterExpression" ) ).toString() );
123 mUseCompleter->setChecked(
config.value( QStringLiteral(
"UseCompleter" ) ).toBool() );
125 const Qt::MatchFlags completerMatchFlags {
config.contains( QStringLiteral(
"CompleterMatchFlags" ) ) ?
static_cast<Qt::MatchFlags
>(
config.value( QStringLiteral(
"CompleterMatchFlags" ), Qt::MatchFlag::MatchStartsWith ).toInt( ) ) : Qt::MatchFlag::MatchStartsWith };
126 mCompleterMatchFromStart->setChecked( completerMatchFlags.testFlag( Qt::MatchFlag::MatchStartsWith ) );
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...
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...
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setHighlightedFunctions(const QStringList &names)
Sets the list of function names intended to be highlighted to the user.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.