28 mKeyColumn->setLayer( mLayerName->currentLayer() );
29 mValueColumn->setLayer( mLayerName->currentLayer() );
30 mGroupColumn->setLayer( mLayerName->currentLayer() );
31 mGroupColumn->setAllowEmptyFieldName(
true );
32 mDescriptionExpression->setLayer( mLayerName->currentLayer() );
40 mNofColumns->setMinimum( 1 );
41 mNofColumns->setMaximum( 10 );
42 mNofColumns->setValue( 1 );
47 connect( mGroupColumn,
static_cast<void ( QComboBox::* )(
int )
>( &QComboBox::currentIndexChanged ),
this, [ = ](
int index )
49 mDisplayGroupName->setEnabled( index != 0 );
58 connect( mAllowMulti, &QAbstractButton::toggled,
this, [ = ](
bool checked )
60 label_nofColumns->setEnabled( checked );
61 mNofColumns->setEnabled( checked );
64 connect( mUseCompleter, &QCheckBox::stateChanged,
this, [ = ](
int state )
66 mCompleterMatchFromStart->setEnabled(
static_cast<Qt::CheckState
>( state ) == Qt::CheckState::Checked );
69 mCompleterMatchFromStart->setEnabled( mUseCompleter->isChecked() );
80 cfg.insert( QStringLiteral(
"Layer" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->id() : QString() );
81 cfg.insert( QStringLiteral(
"LayerName" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->name() : QString() );
82 cfg.insert( QStringLiteral(
"LayerSource" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->publicSource() : QString() );
83 cfg.insert( QStringLiteral(
"LayerProviderName" ), ( mLayerName->currentLayer() && mLayerName->currentLayer()->dataProvider() ) ?
84 mLayerName->currentLayer()->providerType() :
86 cfg.insert( QStringLiteral(
"Key" ), mKeyColumn->currentField() );
87 cfg.insert( QStringLiteral(
"Value" ), mValueColumn->currentField() );
88 cfg.insert( QStringLiteral(
"Group" ), mGroupColumn->currentField() );
89 cfg.insert( QStringLiteral(
"DisplayGroupName" ), mDisplayGroupName->isChecked() );
90 cfg.insert( QStringLiteral(
"Description" ), mDescriptionExpression->expression() );
91 cfg.insert( QStringLiteral(
"AllowMulti" ), mAllowMulti->isChecked() );
92 cfg.insert( QStringLiteral(
"NofColumns" ), mNofColumns->value() );
93 cfg.insert( QStringLiteral(
"AllowNull" ), mAllowNull->isChecked() );
94 cfg.insert( QStringLiteral(
"OrderByValue" ), mOrderByValue->isChecked() );
95 cfg.insert( QStringLiteral(
"FilterExpression" ), mFilterExpression->toPlainText() );
96 cfg.insert( QStringLiteral(
"UseCompleter" ), mUseCompleter->isChecked() );
97 const Qt::MatchFlags completerMatchFlags { mCompleterMatchFromStart->isChecked() ? Qt::MatchFlag::MatchStartsWith : Qt::MatchFlag::MatchContains };
98 cfg.insert( QStringLiteral(
"CompleterMatchFlags" ),
static_cast<int>( completerMatchFlags ) );
106 mLayerName->setLayer( lyr );
107 mKeyColumn->setField(
config.value( QStringLiteral(
"Key" ) ).toString() );
108 mValueColumn->setField(
config.value( QStringLiteral(
"Value" ) ).toString() );
109 mGroupColumn->setField(
config.value( QStringLiteral(
"Group" ) ).toString() );
110 mDisplayGroupName->setChecked(
config.value( QStringLiteral(
"DisplayGroupName" ) ).toBool() );
111 mDescriptionExpression->setField(
config.value( QStringLiteral(
"Description" ) ).toString() );
112 mAllowMulti->setChecked(
config.value( QStringLiteral(
"AllowMulti" ) ).toBool() );
113 mNofColumns->setValue(
config.value( QStringLiteral(
"NofColumns" ), 1 ).toInt() );
114 if ( !mAllowMulti->isChecked() )
116 label_nofColumns->setEnabled(
false );
117 mNofColumns->setEnabled(
false );
119 mAllowNull->setChecked(
config.value( QStringLiteral(
"AllowNull" ) ).toBool() );
120 mOrderByValue->setChecked(
config.value( QStringLiteral(
"OrderByValue" ) ).toBool() );
121 mFilterExpression->setPlainText(
config.value( QStringLiteral(
"FilterExpression" ) ).toString() );
122 mUseCompleter->setChecked(
config.value( QStringLiteral(
"UseCompleter" ) ).toBool() );
124 const Qt::MatchFlags completerMatchFlags {
config.contains( QStringLiteral(
"CompleterMatchFlags" ) ) ?
static_cast<Qt::MatchFlags
>(
config.value( QStringLiteral(
"CompleterMatchFlags" ), Qt::MatchFlag::MatchStartsWith ).toInt( ) ) : Qt::MatchFlag::MatchStartsWith };
125 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.