Skip to content

Commit 9940586

Browse files
committed
Add a changed signal to QgsEditorConfigWidget
And update default value expression preview whenever editor config changes Sponsored by DB Fahrwegdienste GmbH
1 parent e35c6b4 commit 9940586

14 files changed

+78
-0
lines changed

python/gui/editorwidgets/core/qgseditorconfigwidget.sip

+7
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,12 @@ class QgsEditorConfigWidget : QWidget
3838

3939
virtual QgsEditorWidgetConfig config() = 0;
4040
virtual void setConfig( const QgsEditorWidgetConfig& config ) = 0;
41+
42+
signals:
43+
44+
/** Emitted when the configuration of the widget is changed.
45+
* @note added in QGIS 3.0
46+
*/
47+
void changed();
4148
};
4249

src/app/qgsattributetypedialog.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ void QgsAttributeTypeDialog::setWidgetType( const QString& type )
154154
stackedWidget->addWidget( cfgWdg );
155155
stackedWidget->setCurrentWidget( cfgWdg );
156156
mEditorConfigWidgets.insert( type, cfgWdg );
157+
connect( cfgWdg, SIGNAL( changed() ), this, SLOT( defaultExpressionChanged() ) );
157158
}
158159
else
159160
{

src/gui/editorwidgets/core/qgseditorconfigwidget.h

+7
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ class GUI_EXPORT QgsEditorConfigWidget : public QWidget
7676
*/
7777
virtual ~QgsEditorConfigWidget() {}
7878

79+
signals:
80+
81+
/** Emitted when the configuration of the widget is changed.
82+
* @note added in QGIS 3.0
83+
*/
84+
void changed();
85+
7986
private:
8087
QgsVectorLayer* mLayer;
8188
int mField;

src/gui/editorwidgets/qgscheckboxconfigdlg.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ QgsCheckBoxConfigDlg::QgsCheckBoxConfigDlg( QgsVectorLayer* vl, int fieldIdx, QW
1919
: QgsEditorConfigWidget( vl, fieldIdx, parent )
2020
{
2121
setupUi( this );
22+
23+
connect( leCheckedState, SIGNAL( textEdited( QString ) ), this, SIGNAL( changed() ) );
24+
connect( leUncheckedState, SIGNAL( textEdited( QString ) ), this, SIGNAL( changed() ) );
2225
}
2326

2427
QgsEditorWidgetConfig QgsCheckBoxConfigDlg::config()

src/gui/editorwidgets/qgsdatetimeeditconfig.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ QgsDateTimeEditConfig::QgsDateTimeEditConfig( QgsVectorLayer* vl, int fieldIdx,
3333
connect( mFieldHelpToolButton, SIGNAL( clicked( bool ) ), this, SLOT( showHelp( bool ) ) );
3434
connect( mDisplayHelpToolButton, SIGNAL( clicked( bool ) ), this, SLOT( showHelp( bool ) ) );
3535

36+
connect( mFieldFormatEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
37+
connect( mDisplayFormatEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
38+
connect( mCalendarPopupCheckBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
39+
connect( mAllowNullCheckBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
40+
3641
// initialize
3742
updateFieldFormat( mFieldFormatComboBox->currentIndex() );
3843
displayFormatChanged( mDisplayFormatComboBox->currentIndex() );

src/gui/editorwidgets/qgsexternalresourceconfigdlg.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ QgsExternalResourceConfigDlg::QgsExternalResourceConfigDlg( QgsVectorLayer* vl,
5757

5858
mDocumentViewerContentComboBox->addItem( tr( "Image" ), QgsExternalResourceWidget::Image );
5959
mDocumentViewerContentComboBox->addItem( tr( "Web view" ), QgsExternalResourceWidget::Web );
60+
61+
62+
connect( mFileWidgetGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
63+
connect( mFileWidgetButtonGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
64+
connect( mFileWidgetFilterLineEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
65+
connect( mUseLink, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
66+
connect( mFullUrl, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
67+
connect( mRootPath, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
68+
connect( mStorageButtonGroup, SIGNAL( buttonClicked( int ) ), this, SIGNAL( changed() ) );
69+
connect( mRelativeGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
70+
connect( mDocumentViewerGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
71+
connect( mDocumentViewerContentComboBox, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
72+
connect( mDocumentViewerHeight, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
73+
connect( mDocumentViewerWidth, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
6074
}
6175

6276
void QgsExternalResourceConfigDlg::chooseDefaultPath()

src/gui/editorwidgets/qgsphotoconfigdlg.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ QgsPhotoConfigDlg::QgsPhotoConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget
1919
: QgsEditorConfigWidget( vl, fieldIdx, parent )
2020
{
2121
setupUi( this );
22+
connect( sbWidgetHeight, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
23+
connect( sbWidgetWidth, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
2224
}
2325

2426
QgsEditorWidgetConfig QgsPhotoConfigDlg::config()

src/gui/editorwidgets/qgsrangeconfigdlg.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ QgsRangeConfigDlg::QgsRangeConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget
5252
valuesLabel->setText( text );
5353

5454
connect( rangeWidget, SIGNAL( currentIndexChanged( int ) ), this, SLOT( rangeWidgetChanged( int ) ) );
55+
56+
connect( minimumSpinBox, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
57+
connect( maximumSpinBox, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
58+
connect( stepSpinBox, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
59+
connect( minimumDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
60+
connect( maximumDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
61+
connect( stepDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
62+
connect( rangeWidget, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
63+
connect( allowNullCheckBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
64+
connect( suffixLineEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
5565
}
5666

5767
QgsEditorWidgetConfig QgsRangeConfigDlg::config()

src/gui/editorwidgets/qgsrelationreferenceconfigdlg.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ QgsRelationReferenceConfigDlg::QgsRelationReferenceConfigDlg( QgsVectorLayer* vl
4040
mExpressionWidget->setField( relation.referencedLayer()->displayExpression() );
4141
}
4242
}
43+
44+
connect( mCbxAllowNull, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
45+
connect( mCbxOrderByValue, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
46+
connect( mCbxShowForm, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
47+
connect( mCbxMapIdentification, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
48+
connect( mCbxReadOnly, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
49+
connect( mComboRelation, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
50+
connect( mCbxAllowAddFeatures, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
51+
connect( mFilterGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
52+
connect( mFilterFieldsList, SIGNAL( itemChanged( QListWidgetItem* ) ), this, SIGNAL( changed() ) );
53+
connect( mCbxChainFilters, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
54+
connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SIGNAL( changed() ) );
4355
}
4456

4557
void QgsRelationReferenceConfigDlg::setConfig( const QgsEditorWidgetConfig& config )

src/gui/editorwidgets/qgstexteditconfigdlg.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ QgsTextEditConfigDlg::QgsTextEditConfigDlg( QgsVectorLayer* vl, int fieldIdx, QW
2020
: QgsEditorConfigWidget( vl, fieldIdx, parent )
2121
{
2222
setupUi( this );
23+
connect( mIsMultiline, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
24+
connect( mUseHtml, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
2325
}
2426

2527

src/gui/editorwidgets/qgsuniquevaluesconfigdlg.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ QgsUniqueValuesConfigDlg::QgsUniqueValuesConfigDlg( QgsVectorLayer* vl, int fiel
1919
: QgsEditorConfigWidget( vl, fieldIdx, parent )
2020
{
2121
setupUi( this );
22+
connect( editableUniqueValues, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
2223
}
2324

2425

src/gui/editorwidgets/qgsvaluemapconfigdlg.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ void QgsValueMapConfigDlg::vCellChanged( int row, int column )
9292
{
9393
tableWidget->insertRow( row + 1 );
9494
} //else check type
95+
96+
emit changed();
9597
}
9698

9799
void QgsValueMapConfigDlg::removeSelectedButtonPushed()
@@ -116,6 +118,7 @@ void QgsValueMapConfigDlg::removeSelectedButtonPushed()
116118
tableWidget->removeRow( rowsToRemove.values().at( i ) - removed );
117119
removed++;
118120
}
121+
emit changed();
119122
}
120123

121124
void QgsValueMapConfigDlg::updateMap( const QMap<QString, QVariant> &map, bool insertNull )

src/gui/editorwidgets/qgsvaluerelationconfigdlg.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ QgsValueRelationConfigDlg::QgsValueRelationConfigDlg( QgsVectorLayer* vl, int fi
2626
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), mKeyColumn, SLOT( setLayer( QgsMapLayer* ) ) );
2727
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), mValueColumn, SLOT( setLayer( QgsMapLayer* ) ) );
2828
connect( mEditExpression, SIGNAL( clicked() ), this, SLOT( editExpression() ) );
29+
30+
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SIGNAL( changed() ) );
31+
connect( mKeyColumn, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
32+
connect( mValueColumn, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
33+
connect( mAllowMulti, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
34+
connect( mAllowNull, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
35+
connect( mOrderByValue, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
36+
connect( mFilterExpression, SIGNAL( textChanged() ), this, SIGNAL( changed() ) );
37+
connect( mUseCompleter, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
2938
}
3039

3140
QgsEditorWidgetConfig QgsValueRelationConfigDlg::config()

src/gui/editorwidgets/qgswebviewconfigdlg.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ QgsWebViewWidgetConfigDlg::QgsWebViewWidgetConfigDlg( QgsVectorLayer* vl, int fi
1919
: QgsEditorConfigWidget( vl, fieldIdx, parent )
2020
{
2121
setupUi( this );
22+
connect( sbWidgetHeight, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
23+
connect( sbWidgetWidth, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
2224
}
2325

2426
QgsEditorWidgetConfig QgsWebViewWidgetConfigDlg::config()

0 commit comments

Comments
 (0)