From 2e573e369954ebd4f67aeb14dd1c5088349bfdbf Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Sun, 8 Sep 2024 20:30:37 +0200 Subject: [PATCH 1/6] [settings] support direct connection from widget value change to update setting value --- .../qgssettingseditorwidgetwrapper.sip.in | 20 ++++++++++ .../qgssettingseditorwidgetwrapperimpl.sip.in | 15 +++++++ .../qgssettingseditorwidgetwrapper.sip.in | 20 ++++++++++ .../qgssettingseditorwidgetwrapperimpl.sip.in | 15 +++++++ .../settings/qgssettingseditorwidgetwrapper.h | 24 +++++++++++ .../qgssettingseditorwidgetwrapperimpl.cpp | 40 +++++++++++++++++++ .../qgssettingseditorwidgetwrapperimpl.h | 10 +++++ .../qgssettingsenumflageditorwidgetwrapper.h | 32 ++++++++++++++- 8 files changed, 175 insertions(+), 1 deletion(-) diff --git a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in index 5362b6b191d7..745f87e11309 100644 --- a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in +++ b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in @@ -82,6 +82,17 @@ Sets the ``value`` of the widget The wrapper must be configured before calling this medthod %End + void enableAutomaticUpdate(); +%Docstring +Enables automatic update +so that the setting gets update +on value change in the widget and +sets the widget to the current settings value. +This must called after createEditor or configureEditor. + +.. versionadded:: 3.40 +%End + protected: virtual QWidget *createEditorPrivate( QWidget *parent = 0 ) const = 0; @@ -92,6 +103,15 @@ Creates the widgets virtual bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) = 0; %Docstring Configures an existing ``editor`` widget +%End + + virtual void enableAutomaticUpdatePrivate() = 0; +%Docstring +Enables automatic update +so that the setting gets update +on value change in the widget. + +.. versionadded:: 3.40 %End }; diff --git a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in index 270ddc86aa76..08bf87e9b923 100644 --- a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in +++ b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in @@ -109,6 +109,9 @@ Constructor virtual bool setWidgetValue( const QString &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -145,6 +148,9 @@ Constructor virtual bool setWidgetValue( const bool &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -181,6 +187,9 @@ Constructor virtual bool setWidgetValue( const int &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -218,6 +227,9 @@ Constructor virtual bool setWidgetValue( const double &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -258,6 +270,9 @@ Constructor virtual void configureEditorPrivateImplementation(); + + virtual void enableAutomaticUpdatePrivate(); + }; diff --git a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in index 5362b6b191d7..745f87e11309 100644 --- a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in +++ b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in @@ -82,6 +82,17 @@ Sets the ``value`` of the widget The wrapper must be configured before calling this medthod %End + void enableAutomaticUpdate(); +%Docstring +Enables automatic update +so that the setting gets update +on value change in the widget and +sets the widget to the current settings value. +This must called after createEditor or configureEditor. + +.. versionadded:: 3.40 +%End + protected: virtual QWidget *createEditorPrivate( QWidget *parent = 0 ) const = 0; @@ -92,6 +103,15 @@ Creates the widgets virtual bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) = 0; %Docstring Configures an existing ``editor`` widget +%End + + virtual void enableAutomaticUpdatePrivate() = 0; +%Docstring +Enables automatic update +so that the setting gets update +on value change in the widget. + +.. versionadded:: 3.40 %End }; diff --git a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in index 270ddc86aa76..08bf87e9b923 100644 --- a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in +++ b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in @@ -109,6 +109,9 @@ Constructor virtual bool setWidgetValue( const QString &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -145,6 +148,9 @@ Constructor virtual bool setWidgetValue( const bool &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -181,6 +187,9 @@ Constructor virtual bool setWidgetValue( const int &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -218,6 +227,9 @@ Constructor virtual bool setWidgetValue( const double &value ) const; + + virtual void enableAutomaticUpdatePrivate(); + }; @@ -258,6 +270,9 @@ Constructor virtual void configureEditorPrivateImplementation(); + + virtual void enableAutomaticUpdatePrivate(); + }; diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.h b/src/gui/settings/qgssettingseditorwidgetwrapper.h index db6b85d49cf2..59f37a1642f5 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.h @@ -80,6 +80,23 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject */ virtual void setWidgetFromVariant( const QVariant &value ) const = 0; + /** + * Enables automatic update, which causes the setting to be updated immediately when the widget + * value is changed. + * + * Calling this method will set the widget's current value to match the current settings value. + * + * \note This must called after createEditor() or configureEditor(). + * \warning Do NOT call this method from places where a widget is embedded in a dialog with a cancel button, as the auto-update logic will immediately overwrite the setting value and prevent rollback if the user cancels the dialog. + * + * \since QGIS 3.40 + */ + void enableAutomaticUpdate() + { + setWidgetFromSetting(); + enableAutomaticUpdatePrivate(); + } + protected: //! Creates the widgets @@ -88,6 +105,13 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject //! Configures an existing \a editor widget virtual bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) = 0; + /** + * Enables automatic update, which causes the setting to be updated immediately when the widget + * value is changed. + * \since QGIS 3.40 + */ + virtual void enableAutomaticUpdatePrivate() = 0; + QStringList mDynamicKeyPartList; }; diff --git a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp index ab1b0b23ae33..ebe5706da57a 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp +++ b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp @@ -46,6 +46,14 @@ bool QgsSettingsStringEditorWidgetWrapper::setWidgetValue( const QString &value return false; } +void QgsSettingsStringEditorWidgetWrapper::enableAutomaticUpdatePrivate() +{ + QObject::connect( this->mEditor, &QLineEdit::textChanged, this, [ = ]( const QString & text ) + { + this->mSetting->setValue( text, this->mDynamicKeyPartList ); + } ); +} + bool QgsSettingsStringEditorWidgetWrapper::setSettingFromWidget() const { if ( mEditor ) @@ -96,6 +104,14 @@ bool QgsSettingsBoolEditorWidgetWrapper::setWidgetValue( const bool &value ) con return false; } +void QgsSettingsBoolEditorWidgetWrapper::enableAutomaticUpdatePrivate() +{ + QObject::connect( this->mEditor, &QCheckBox::clicked, this, [ = ]( bool checked ) + { + this->mSetting->setValue( checked, this->mDynamicKeyPartList ); + } ); +} + bool QgsSettingsBoolEditorWidgetWrapper::setSettingFromWidget() const { if ( mEditor ) @@ -148,6 +164,14 @@ bool QgsSettingsIntegerEditorWidgetWrapper::setWidgetValue( const int &value ) c return false; } +void QgsSettingsIntegerEditorWidgetWrapper::enableAutomaticUpdatePrivate() +{ + QObject::connect( this->mEditor, qOverload( &QSpinBox::valueChanged ), this, [ = ]( int value ) + { + this->mSetting->setValue( value, this->mDynamicKeyPartList ); + } ); +} + bool QgsSettingsIntegerEditorWidgetWrapper::setSettingFromWidget() const { if ( mEditor ) @@ -200,6 +224,14 @@ bool QgsSettingsDoubleEditorWidgetWrapper::setWidgetValue( const double &value ) return false; } +void QgsSettingsDoubleEditorWidgetWrapper::enableAutomaticUpdatePrivate() +{ + QObject::connect( this->mEditor, qOverload( &QDoubleSpinBox::valueChanged ), this, [ = ]( double value ) + { + this->mSetting->setValue( value, this->mDynamicKeyPartList ); + } ); +} + bool QgsSettingsDoubleEditorWidgetWrapper::setSettingFromWidget() const { if ( mEditor ) @@ -262,6 +294,14 @@ void QgsSettingsColorEditorWidgetWrapper::configureEditorPrivateImplementation() } } +void QgsSettingsColorEditorWidgetWrapper::enableAutomaticUpdatePrivate() +{ + QObject::connect( this->mEditor, &QgsColorButton::colorChanged, this, [ = ]( const QColor & color ) + { + this->mSetting->setValue( color, this->mDynamicKeyPartList ); + } ); +} + bool QgsSettingsColorEditorWidgetWrapper::setSettingFromWidget() const { if ( mEditor ) diff --git a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h index b9e3b134b688..d71e10cbfdb3 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h @@ -139,6 +139,8 @@ class GUI_EXPORT QgsSettingsStringEditorWidgetWrapper : public QgsSettingsEditor QString valueFromWidget() const override; bool setWidgetValue( const QString &value ) const override; + + void enableAutomaticUpdatePrivate() override; }; /** @@ -164,6 +166,8 @@ class GUI_EXPORT QgsSettingsBoolEditorWidgetWrapper : public QgsSettingsEditorWi bool valueFromWidget() const override; bool setWidgetValue( const bool &value ) const override; + + void enableAutomaticUpdatePrivate() override; }; /** @@ -189,6 +193,8 @@ class GUI_EXPORT QgsSettingsIntegerEditorWidgetWrapper : public QgsSettingsEdito int valueFromWidget() const override; bool setWidgetValue( const int &value ) const override; + + void enableAutomaticUpdatePrivate() override; }; @@ -215,6 +221,8 @@ class GUI_EXPORT QgsSettingsDoubleEditorWidgetWrapper : public QgsSettingsEditor double valueFromWidget() const override; bool setWidgetValue( const double &value ) const override; + + void enableAutomaticUpdatePrivate() override; }; @@ -243,6 +251,8 @@ class GUI_EXPORT QgsSettingsColorEditorWidgetWrapper : public QgsSettingsEditorW bool setWidgetValue( const QColor &value ) const override; void configureEditorPrivateImplementation() override; + + void enableAutomaticUpdatePrivate() override; }; diff --git a/src/gui/settings/qgssettingsenumflageditorwidgetwrapper.h b/src/gui/settings/qgssettingsenumflageditorwidgetwrapper.h index 86beaa9e7c60..e307ed24d545 100644 --- a/src/gui/settings/qgssettingsenumflageditorwidgetwrapper.h +++ b/src/gui/settings/qgssettingsenumflageditorwidgetwrapper.h @@ -43,6 +43,15 @@ class GUI_EXPORT QgsSettingsFlagsEditorWidgetWrapper : public QgsSettingsEditorW : QgsSettingsEditorWidgetWrapperTemplate, QComboBox, FLAGS>( parent ) {} + void enableAutomaticUpdatePrivate() override + { + QObject::connect( &mModel, &QStandardItemModel::itemChanged, this, [ = ]( const QStandardItem * item ) + { + Q_UNUSED( item ) + setSettingFromWidget(); + } ); + } + QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsFlagsEditorWidgetWrapper( parent );} virtual QString id() const override @@ -144,11 +153,28 @@ class QgsSettingsEnumEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplate, QComboBox, ENUM>( parent ) {} + void enableAutomaticUpdatePrivate() override + { + QObject::connect( this->mEditor, qOverload( &QComboBox::currentIndexChanged ), this, [ = ]( int index ) + { + Q_UNUSED( index ); + ENUM value = this->mEditor->currentData().template value(); + this->mSetting->setValue( value, this->mDynamicKeyPartList ); + } ); + } + virtual QString id() const override { return QStringLiteral( "%1-%2" ).arg( sSettingsTypeMetaEnum.valueToKey( static_cast( Qgis::SettingsType::EnumFlag ) ), QMetaEnum::fromType().name() ); } + /** + * This will set the display strings so they can be readable and translatable. + * This must be called before calling createEditor or configureEditor. + * \since QGIS 3.40 + */ + void setDisplayStrings( const QMap &displayStrings ) { mDisplayStrings = displayStrings; } + QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsEnumEditorWidgetWrapper( parent );} QVariant variantValueFromWidget() const override @@ -206,10 +232,14 @@ class QgsSettingsEnumEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapper const QMap enumMap = qgsEnumMap(); for ( auto it = enumMap.constBegin(); it != enumMap.constEnd(); ++it ) { - this->mEditor->addItem( it.value(), QVariant::fromValue( it.key() ) ); + const QString displayString = mDisplayStrings.value( it.key(), it.value() ); + this->mEditor->addItem( displayString, QVariant::fromValue( it.key() ) ); } } + private: + QMap mDisplayStrings; + }; #endif // QGSSETTINGSENUMFLAGEDITORWIDGETWRAPPER_H From e939c09a55313debb5552eb07b11b112e7145c7d Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Wed, 11 Sep 2024 16:01:42 +0200 Subject: [PATCH 2/6] support automatic setting update on dialog accept --- .../qgssettingseditorwidgetwrapper.sip.in | 22 +++++++++++-------- .../qgssettingseditorwidgetwrapper.cpp | 17 ++++++++++++++ .../settings/qgssettingseditorwidgetwrapper.h | 12 +++++----- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in index 745f87e11309..353748b91c93 100644 --- a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in +++ b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in @@ -10,6 +10,7 @@ + class QgsSettingsEditorWidgetWrapper : QObject { %Docstring(signature="appended") @@ -82,13 +83,17 @@ Sets the ``value`` of the widget The wrapper must be configured before calling this medthod %End - void enableAutomaticUpdate(); + void enableAutomaticUpdate( QDialog *dialog = 0 ); %Docstring -Enables automatic update -so that the setting gets update -on value change in the widget and -sets the widget to the current settings value. -This must called after createEditor or configureEditor. +Enables automatic update, which causes the setting to be updated immediately when the widget +value is changed. + +If a ``dialog`` is provided, the setting will be updated when the dialog is accpeted. +If not, the setting will be updated directly at each widget value change. + +.. note:: + + This must called after :py:func:`~QgsSettingsEditorWidgetWrapper.createEditor` or :py:func:`~QgsSettingsEditorWidgetWrapper.configureEditor`. .. versionadded:: 3.40 %End @@ -107,9 +112,8 @@ Configures an existing ``editor`` widget virtual void enableAutomaticUpdatePrivate() = 0; %Docstring -Enables automatic update -so that the setting gets update -on value change in the widget. +Enables automatic update, which causes the setting to be updated immediately when the widget +value is changed. .. versionadded:: 3.40 %End diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.cpp b/src/gui/settings/qgssettingseditorwidgetwrapper.cpp index ace0c73f5f2f..143c9090bf34 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.cpp +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.cpp @@ -19,6 +19,7 @@ #include "qgslogger.h" #include "qgssettingsentry.h" +#include #include @@ -59,3 +60,19 @@ bool QgsSettingsEditorWidgetWrapper::configureEditor( QWidget *editor, const Qgs return ok; } + +void QgsSettingsEditorWidgetWrapper::enableAutomaticUpdate( QDialog *dialog ) +{ + setWidgetFromSetting(); + if ( dialog ) + { + QObject::connect( dialog, &QDialog::accepted, this, [ = ]() + { + setSettingFromWidget(); + } ); + } + else + { + enableAutomaticUpdatePrivate(); + } +} diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.h b/src/gui/settings/qgssettingseditorwidgetwrapper.h index 59f37a1642f5..f145723860cf 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.h @@ -23,6 +23,8 @@ class QgsSettingsEntryBase; +class QDialog; + /** * \ingroup gui * \brief Base class for settings editor wrappers @@ -84,18 +86,14 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject * Enables automatic update, which causes the setting to be updated immediately when the widget * value is changed. * - * Calling this method will set the widget's current value to match the current settings value. + * If a \a dialog is provided, the setting will be updated when the dialog is accpeted. + * If not, the setting will be updated directly at each widget value change. * * \note This must called after createEditor() or configureEditor(). - * \warning Do NOT call this method from places where a widget is embedded in a dialog with a cancel button, as the auto-update logic will immediately overwrite the setting value and prevent rollback if the user cancels the dialog. * * \since QGIS 3.40 */ - void enableAutomaticUpdate() - { - setWidgetFromSetting(); - enableAutomaticUpdatePrivate(); - } + void enableAutomaticUpdate( QDialog *dialog = nullptr ); protected: From 3e14920d50991686dcf13d28f666c3785207027f Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Wed, 11 Sep 2024 17:44:50 +0200 Subject: [PATCH 3/6] add settings entry --- src/gui/qgsgui.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/gui/qgsgui.h b/src/gui/qgsgui.h index d45056f4736f..c7ec0c0543f8 100644 --- a/src/gui/qgsgui.h +++ b/src/gui/qgsgui.h @@ -19,6 +19,7 @@ #define QGSGUI_H #include "qgis_gui.h" +#include "qgssettingstree.h" #include "qgis_sip.h" #include #include @@ -64,6 +65,8 @@ class GUI_EXPORT QgsGui : public QObject public: + static inline QgsSettingsTreeNode *sTtreeWidgetLastUsedValues = QgsSettingsTree::sTreeApp->createChildNode( QStringLiteral( "widget-last-used-values" ) ) SIP_SKIP; + /** * Defines the behavior to use when setting the CRS for a newly created project. */ From 6c6465b5ffc24efdffbfe948d848cf3db6c452a8 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Thu, 12 Sep 2024 11:22:25 +0200 Subject: [PATCH 4/6] better name + fix typo --- src/gui/settings/qgssettingseditorwidgetwrapper.cpp | 2 +- src/gui/settings/qgssettingseditorwidgetwrapper.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.cpp b/src/gui/settings/qgssettingseditorwidgetwrapper.cpp index 143c9090bf34..039c1a7ba9bd 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.cpp +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.cpp @@ -61,7 +61,7 @@ bool QgsSettingsEditorWidgetWrapper::configureEditor( QWidget *editor, const Qgs return ok; } -void QgsSettingsEditorWidgetWrapper::enableAutomaticUpdate( QDialog *dialog ) +void QgsSettingsEditorWidgetWrapper::configureAutomaticUpdate( QDialog *dialog ) { setWidgetFromSetting(); if ( dialog ) diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.h b/src/gui/settings/qgssettingseditorwidgetwrapper.h index f145723860cf..cf7ae8c1abc4 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.h @@ -86,14 +86,14 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject * Enables automatic update, which causes the setting to be updated immediately when the widget * value is changed. * - * If a \a dialog is provided, the setting will be updated when the dialog is accpeted. + * If a \a dialog is provided, the setting will be updated when the dialog is accepted. * If not, the setting will be updated directly at each widget value change. * * \note This must called after createEditor() or configureEditor(). * * \since QGIS 3.40 */ - void enableAutomaticUpdate( QDialog *dialog = nullptr ); + void configureAutomaticUpdate( QDialog *dialog = nullptr ); protected: From 15a4fdb41afd2dee7c5ef7281a88ccad5c0adcb0 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Thu, 12 Sep 2024 11:39:44 +0200 Subject: [PATCH 5/6] Update src/gui/settings/qgssettingseditorwidgetwrapper.h Co-authored-by: Mathieu Pellerin --- src/gui/settings/qgssettingseditorwidgetwrapper.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.h b/src/gui/settings/qgssettingseditorwidgetwrapper.h index cf7ae8c1abc4..df52643c321d 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.h @@ -83,8 +83,7 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject virtual void setWidgetFromVariant( const QVariant &value ) const = 0; /** - * Enables automatic update, which causes the setting to be updated immediately when the widget - * value is changed. + * Configure the settings update behavior when a widget value is changed. * * If a \a dialog is provided, the setting will be updated when the dialog is accepted. * If not, the setting will be updated directly at each widget value change. From 8ded78f26bf8f459c47781ff8e0f0a5e7d6a54d6 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Thu, 12 Sep 2024 14:08:16 +0200 Subject: [PATCH 6/6] sipify --- .../qgssettingseditorwidgetwrapper.sip.in | 22 +++++++++++-------- .../qgssettingseditorwidgetwrapper.sip.in | 4 ++-- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in index 745f87e11309..5a3c41787aac 100644 --- a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in +++ b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in @@ -10,6 +10,7 @@ + class QgsSettingsEditorWidgetWrapper : QObject { %Docstring(signature="appended") @@ -82,13 +83,17 @@ Sets the ``value`` of the widget The wrapper must be configured before calling this medthod %End - void enableAutomaticUpdate(); + void configureAutomaticUpdate( QDialog *dialog = 0 ); %Docstring -Enables automatic update -so that the setting gets update -on value change in the widget and -sets the widget to the current settings value. -This must called after createEditor or configureEditor. +Enables automatic update, which causes the setting to be updated immediately when the widget +value is changed. + +If a ``dialog`` is provided, the setting will be updated when the dialog is accepted. +If not, the setting will be updated directly at each widget value change. + +.. note:: + + This must called after :py:func:`~QgsSettingsEditorWidgetWrapper.createEditor` or :py:func:`~QgsSettingsEditorWidgetWrapper.configureEditor`. .. versionadded:: 3.40 %End @@ -107,9 +112,8 @@ Configures an existing ``editor`` widget virtual void enableAutomaticUpdatePrivate() = 0; %Docstring -Enables automatic update -so that the setting gets update -on value change in the widget. +Enables automatic update, which causes the setting to be updated immediately when the widget +value is changed. .. versionadded:: 3.40 %End diff --git a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in index 353748b91c93..5a3c41787aac 100644 --- a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in +++ b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in @@ -83,12 +83,12 @@ Sets the ``value`` of the widget The wrapper must be configured before calling this medthod %End - void enableAutomaticUpdate( QDialog *dialog = 0 ); + void configureAutomaticUpdate( QDialog *dialog = 0 ); %Docstring Enables automatic update, which causes the setting to be updated immediately when the widget value is changed. -If a ``dialog`` is provided, the setting will be updated when the dialog is accpeted. +If a ``dialog`` is provided, the setting will be updated when the dialog is accepted. If not, the setting will be updated directly at each widget value change. .. note::