28 mKeyColumn->setLayer( mLayerName->currentLayer() );
29 mValueColumn->setLayer( mLayerName->currentLayer() );
30 mDescriptionExpression->setLayer( mLayerName->currentLayer() );
37 mNofColumns->setMinimum( 1 );
38 mNofColumns->setMaximum( 10 );
39 mNofColumns->setValue( 1 );
50 connect( mAllowMulti, &QAbstractButton::toggled,
this, [ = ](
bool checked )
52 label_nofColumns->setEnabled( checked );
53 mNofColumns->setEnabled( checked );
66 cfg.insert( QStringLiteral(
"Layer" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->id() : QString() );
67 cfg.insert( QStringLiteral(
"LayerName" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->name() : QString() );
68 cfg.insert( QStringLiteral(
"LayerSource" ), mLayerName->currentLayer() ? mLayerName->currentLayer()->publicSource() : QString() );
69 cfg.insert( QStringLiteral(
"LayerProviderName" ), ( mLayerName->currentLayer() && mLayerName->currentLayer()->dataProvider() ) ?
70 mLayerName->currentLayer()->providerType() :
72 cfg.insert( QStringLiteral(
"Key" ), mKeyColumn->currentField() );
73 cfg.insert( QStringLiteral(
"Value" ), mValueColumn->currentField() );
74 cfg.insert( QStringLiteral(
"Description" ), mDescriptionExpression->expression() );
75 cfg.insert( QStringLiteral(
"AllowMulti" ), mAllowMulti->isChecked() );
76 cfg.insert( QStringLiteral(
"NofColumns" ), mNofColumns->value() );
77 cfg.insert( QStringLiteral(
"AllowNull" ), mAllowNull->isChecked() );
78 cfg.insert( QStringLiteral(
"OrderByValue" ), mOrderByValue->isChecked() );
79 cfg.insert( QStringLiteral(
"FilterExpression" ), mFilterExpression->toPlainText() );
80 cfg.insert( QStringLiteral(
"UseCompleter" ), mUseCompleter->isChecked() );
88 mLayerName->setLayer( lyr );
89 mKeyColumn->setField(
config.value( QStringLiteral(
"Key" ) ).toString() );
90 mValueColumn->setField(
config.value( QStringLiteral(
"Value" ) ).toString() );
91 mDescriptionExpression->setField(
config.value( QStringLiteral(
"Description" ) ).toString() );
92 mAllowMulti->setChecked(
config.value( QStringLiteral(
"AllowMulti" ) ).toBool() );
93 mNofColumns->setValue(
config.value( QStringLiteral(
"NofColumns" ), 1 ).toInt() );
94 if ( !mAllowMulti->isChecked() )
96 label_nofColumns->setEnabled(
false );
97 mNofColumns->setEnabled(
false );
99 mAllowNull->setChecked(
config.value( QStringLiteral(
"AllowNull" ) ).toBool() );
100 mOrderByValue->setChecked(
config.value( QStringLiteral(
"OrderByValue" ) ).toBool() );
101 mFilterExpression->setPlainText(
config.value( QStringLiteral(
"FilterExpression" ) ).toString() );
102 mUseCompleter->setChecked(
config.value( QStringLiteral(
"UseCompleter" ) ).toBool() );
105 void QgsValueRelationConfigDlg::layerChanged()
107 mFilterExpression->setEnabled( qobject_cast<QgsVectorLayer *>( mLayerName->currentLayer() ) );
108 mEditExpression->setEnabled( qobject_cast<QgsVectorLayer *>( mLayerName->currentLayer() ) );
113 QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( mLayerName->currentLayer() );
121 context.
setHighlightedFunctions( QStringList() << QStringLiteral(
"current_value" ) << QStringLiteral(
"current_parent_value" ) );
123 << QStringLiteral(
"current_feature" )
124 << QStringLiteral(
"form_mode" )
125 << QStringLiteral(
"current_parent_geometry" )
126 << QStringLiteral(
"current_parent_feature" ) );
129 dlg.setWindowTitle( tr(
"Edit Filter Expression" ) );
131 if ( dlg.exec() == QDialog::Accepted )