Skip to content
Permalink
Browse files

Add a changed signal to QgsEditorConfigWidget

And update default value expression preview whenever editor
config changes

Sponsored by DB Fahrwegdienste GmbH
  • Loading branch information
nyalldawson committed Aug 30, 2016
1 parent c625487 commit f32b85e1f8cfb2c934e472daec0b9fc37ba7f6aa
@@ -38,5 +38,12 @@ class QgsEditorConfigWidget : QWidget

virtual QgsEditorWidgetConfig config() = 0;
virtual void setConfig( const QgsEditorWidgetConfig& config ) = 0;

signals:

/** Emitted when the configuration of the widget is changed.
* @note added in QGIS 3.0
*/
void changed();
};

@@ -154,6 +154,7 @@ void QgsAttributeTypeDialog::setWidgetV2Type( const QString& type )
stackedWidget->addWidget( cfgWdg );
stackedWidget->setCurrentWidget( cfgWdg );
mEditorConfigWidgets.insert( type, cfgWdg );
connect( cfgWdg, SIGNAL( changed() ), this, SLOT( defaultExpressionChanged() ) );
}
else
{
@@ -76,6 +76,13 @@ class GUI_EXPORT QgsEditorConfigWidget : public QWidget
*/
virtual ~QgsEditorConfigWidget() {}

signals:

/** Emitted when the configuration of the widget is changed.
* @note added in QGIS 3.0
*/
void changed();

private:
QgsVectorLayer* mLayer;
int mField;
@@ -19,6 +19,9 @@ QgsCheckBoxConfigDlg::QgsCheckBoxConfigDlg( QgsVectorLayer* vl, int fieldIdx, QW
: QgsEditorConfigWidget( vl, fieldIdx, parent )
{
setupUi( this );

connect( leCheckedState, SIGNAL( textEdited( QString ) ), this, SIGNAL( changed() ) );
connect( leUncheckedState, SIGNAL( textEdited( QString ) ), this, SIGNAL( changed() ) );
}

QgsEditorWidgetConfig QgsCheckBoxConfigDlg::config()
@@ -33,6 +33,11 @@ QgsDateTimeEditConfig::QgsDateTimeEditConfig( QgsVectorLayer* vl, int fieldIdx,
connect( mFieldHelpToolButton, SIGNAL( clicked( bool ) ), this, SLOT( showHelp( bool ) ) );
connect( mDisplayHelpToolButton, SIGNAL( clicked( bool ) ), this, SLOT( showHelp( bool ) ) );

connect( mFieldFormatEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
connect( mDisplayFormatEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
connect( mCalendarPopupCheckBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mAllowNullCheckBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );

// initialize
updateFieldFormat( mFieldFormatComboBox->currentIndex() );
displayFormatChanged( mDisplayFormatComboBox->currentIndex() );
@@ -57,6 +57,20 @@ QgsExternalResourceConfigDlg::QgsExternalResourceConfigDlg( QgsVectorLayer* vl,

mDocumentViewerContentComboBox->addItem( tr( "Image" ), QgsExternalResourceWidget::Image );
mDocumentViewerContentComboBox->addItem( tr( "Web view" ), QgsExternalResourceWidget::Web );


connect( mFileWidgetGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mFileWidgetButtonGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mFileWidgetFilterLineEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
connect( mUseLink, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mFullUrl, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mRootPath, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
connect( mStorageButtonGroup, SIGNAL( buttonClicked( int ) ), this, SIGNAL( changed() ) );
connect( mRelativeGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mDocumentViewerGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mDocumentViewerContentComboBox, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
connect( mDocumentViewerHeight, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
connect( mDocumentViewerWidth, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
}

void QgsExternalResourceConfigDlg::chooseDefaultPath()
@@ -19,6 +19,8 @@ QgsPhotoConfigDlg::QgsPhotoConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget
: QgsEditorConfigWidget( vl, fieldIdx, parent )
{
setupUi( this );
connect( sbWidgetHeight, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
connect( sbWidgetWidth, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
}

QgsEditorWidgetConfig QgsPhotoConfigDlg::config()
@@ -52,6 +52,16 @@ QgsRangeConfigDlg::QgsRangeConfigDlg( QgsVectorLayer* vl, int fieldIdx, QWidget
valuesLabel->setText( text );

connect( rangeWidget, SIGNAL( currentIndexChanged( int ) ), this, SLOT( rangeWidgetChanged( int ) ) );

connect( minimumSpinBox, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
connect( maximumSpinBox, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
connect( stepSpinBox, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
connect( minimumDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
connect( maximumDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
connect( stepDoubleSpinBox, SIGNAL( valueChanged( double ) ), this, SIGNAL( changed() ) );
connect( rangeWidget, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
connect( allowNullCheckBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( suffixLineEdit, SIGNAL( textChanged( QString ) ), this, SIGNAL( changed() ) );
}

QgsEditorWidgetConfig QgsRangeConfigDlg::config()
@@ -53,6 +53,18 @@ QgsRelationReferenceConfigDlg::QgsRelationReferenceConfigDlg( QgsVectorLayer* vl
mExpressionWidget->setField( relation.referencedLayer()->displayExpression() );
}
}

connect( mCbxAllowNull, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mCbxOrderByValue, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mCbxShowForm, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mCbxMapIdentification, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mCbxReadOnly, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mComboRelation, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
connect( mCbxAllowAddFeatures, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mFilterGroupBox, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mFilterFieldsList, SIGNAL( itemChanged( QListWidgetItem* ) ), this, SIGNAL( changed() ) );
connect( mCbxChainFilters, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mExpressionWidget, SIGNAL( fieldChanged( QString ) ), this, SIGNAL( changed() ) );
}

void QgsRelationReferenceConfigDlg::setConfig( const QgsEditorWidgetConfig& config )
@@ -19,6 +19,8 @@ QgsTextEditConfigDlg::QgsTextEditConfigDlg( QgsVectorLayer* vl, int fieldIdx, QW
: QgsEditorConfigWidget( vl, fieldIdx, parent )
{
setupUi( this );
connect( mIsMultiline, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mUseHtml, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
}


@@ -19,6 +19,7 @@ QgsUniqueValuesConfigDlg::QgsUniqueValuesConfigDlg( QgsVectorLayer* vl, int fiel
: QgsEditorConfigWidget( vl, fieldIdx, parent )
{
setupUi( this );
connect( editableUniqueValues, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
}


@@ -92,6 +92,8 @@ void QgsValueMapConfigDlg::vCellChanged( int row, int column )
{
tableWidget->insertRow( row + 1 );
} //else check type

emit changed();
}

void QgsValueMapConfigDlg::removeSelectedButtonPushed()
@@ -116,6 +118,7 @@ void QgsValueMapConfigDlg::removeSelectedButtonPushed()
tableWidget->removeRow( rowsToRemove.values().at( i ) - removed );
removed++;
}
emit changed();
}

void QgsValueMapConfigDlg::updateMap( const QMap<QString, QVariant> &map, bool insertNull )
@@ -26,6 +26,15 @@ QgsValueRelationConfigDlg::QgsValueRelationConfigDlg( QgsVectorLayer* vl, int fi
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), mKeyColumn, SLOT( setLayer( QgsMapLayer* ) ) );
connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), mValueColumn, SLOT( setLayer( QgsMapLayer* ) ) );
connect( mEditExpression, SIGNAL( clicked() ), this, SLOT( editExpression() ) );

connect( mLayerName, SIGNAL( layerChanged( QgsMapLayer* ) ), this, SIGNAL( changed() ) );
connect( mKeyColumn, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
connect( mValueColumn, SIGNAL( currentIndexChanged( int ) ), this, SIGNAL( changed() ) );
connect( mAllowMulti, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mAllowNull, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mOrderByValue, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
connect( mFilterExpression, SIGNAL( textChanged() ), this, SIGNAL( changed() ) );
connect( mUseCompleter, SIGNAL( toggled( bool ) ), this, SIGNAL( changed() ) );
}

QgsEditorWidgetConfig QgsValueRelationConfigDlg::config()
@@ -19,6 +19,8 @@ QgsWebViewWidgetConfigDlg::QgsWebViewWidgetConfigDlg( QgsVectorLayer* vl, int fi
: QgsEditorConfigWidget( vl, fieldIdx, parent )
{
setupUi( this );
connect( sbWidgetHeight, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
connect( sbWidgetWidth, SIGNAL( valueChanged( int ) ), this, SIGNAL( changed() ) );
}

QgsEditorWidgetConfig QgsWebViewWidgetConfigDlg::config()

0 comments on commit f32b85e

Please sign in to comment.
You can’t perform that action at this time.