From ec839e9d7ca61f7c45477e09563701735e12bdd5 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Mon, 7 Oct 2024 07:24:40 +0200 Subject: [PATCH] rename settings editor widget wrappers (#58974) to allow more than 1 widget type to be supported for each type of setting --- .../qgssettingseditorwidgetwrapperimpl.py | 10 ++-- .../qgssettingseditorwidgetwrapperimpl.sip.in | 31 +++++------ python/gui/__init__.py.in | 7 +++ .../qgssettingseditorwidgetwrapperimpl.py | 10 ++-- .../qgssettingseditorwidgetwrapperimpl.sip.in | 31 +++++------ .../qgssettingseditorwidgetregistry.cpp | 10 ++-- .../qgssettingseditorwidgetwrapperimpl.cpp | 52 +++++++++---------- .../qgssettingseditorwidgetwrapperimpl.h | 41 ++++++++------- 8 files changed, 101 insertions(+), 91 deletions(-) diff --git a/python/PyQt6/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py b/python/PyQt6/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py index f1e8da65628b..09e5cbb45257 100644 --- a/python/PyQt6/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py +++ b/python/PyQt6/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py @@ -4,22 +4,22 @@ except NameError: pass try: - QgsSettingsStringEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsStringLineEditWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsBoolEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsBoolCheckBoxWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsIntegerEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsIntegerSpinBoxWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsDoubleEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsDoubleSpinBoxWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsColorEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsColorButtonWrapper.__group__ = ['settings'] except NameError: pass diff --git a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in index 08bf87e9b923..e4c9ffada89f 100644 --- a/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in +++ b/python/PyQt6/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in @@ -78,10 +78,10 @@ To be re-implemented to implemeent type specific configuration (e.g. opacity for typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase; -class QgsSettingsStringEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase +class QgsSettingsStringLineEditWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase { %Docstring(signature="appended") -This class is a factory of editor for string settings +This class is a factory of editor for string settings with a line edit .. versionadded:: 3.32 %End @@ -91,7 +91,7 @@ This class is a factory of editor for string settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase; %End public: - QgsSettingsStringEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsStringLineEditWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -115,12 +115,13 @@ Constructor }; + typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase; -class QgsSettingsBoolEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase +class QgsSettingsBoolCheckBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase { %Docstring(signature="appended") -This class is a factory of editor for boolean settings +This class is a factory of editor for boolean settings with a checkbox .. versionadded:: 3.32 %End @@ -130,7 +131,7 @@ This class is a factory of editor for boolean settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase; %End public: - QgsSettingsBoolEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsBoolCheckBoxWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -156,10 +157,10 @@ Constructor typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase; -class QgsSettingsIntegerEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase +class QgsSettingsIntegerSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase { %Docstring(signature="appended") -This class is a factory of editor for integer settings +This class is a factory of editor for integer settings with a spin box .. versionadded:: 3.32 %End @@ -169,7 +170,7 @@ This class is a factory of editor for integer settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase; %End public: - QgsSettingsIntegerEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsIntegerSpinBoxWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -196,10 +197,10 @@ Constructor typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase; -class QgsSettingsDoubleEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase +class QgsSettingsDoubleSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase { %Docstring(signature="appended") -This class is a factory of editor for double settings +This class is a factory of editor for double settings with a double spin box .. versionadded:: 3.32 %End @@ -209,7 +210,7 @@ This class is a factory of editor for double settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase; %End public: - QgsSettingsDoubleEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsDoubleSpinBoxWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -236,10 +237,10 @@ Constructor typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase; -class QgsSettingsColorEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase +class QgsSettingsColorButtonWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase { %Docstring(signature="appended") -This class is a factory of editor for color settings +This class is a factory of editor for color settings with a color button .. versionadded:: 3.32 %End @@ -249,7 +250,7 @@ This class is a factory of editor for color settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase; %End public: - QgsSettingsColorEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsColorButtonWrapper( QObject *parent = 0 ); %Docstring Constructor %End diff --git a/python/gui/__init__.py.in b/python/gui/__init__.py.in index 664ca33cb7dd..5b120c3b6e9d 100644 --- a/python/gui/__init__.py.in +++ b/python/gui/__init__.py.in @@ -76,3 +76,10 @@ QgsMapLayerAction.EnabledOnlyWhenEditable = _Qgis.MapLayerActionFlag.EnabledOnly QgsMapLayerAction.EnabledOnlyWhenEditable.is_monkey_patched = True QgsMapLayerAction.EnabledOnlyWhenEditable.__doc__ = "Action should be shown only for editable layers" QgsMapLayerAction.Flags = _Qgis.MapLayerActionFlags + +# monkey patch old settings wrappers +QgsSettingsStringEditorWidgetWrapper = QgsSettingsStringLineEditWrapper +QgsSettingsBoolEditorWidgetWrapper = QgsSettingsBoolCheckBoxWrapper +QgsSettingsIntegerEditorWidgetWrapper = QgsSettingsIntegerSpinBoxWrapper +QgsSettingsDoubleEditorWidgetWrapper = QgsSettingsDoubleSpinBoxWrapper +QgsSettingsColorEditorWidgetWrapper = QgsSettingsColorButtonWrapper diff --git a/python/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py b/python/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py index f1e8da65628b..09e5cbb45257 100644 --- a/python/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py +++ b/python/gui/auto_additions/qgssettingseditorwidgetwrapperimpl.py @@ -4,22 +4,22 @@ except NameError: pass try: - QgsSettingsStringEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsStringLineEditWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsBoolEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsBoolCheckBoxWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsIntegerEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsIntegerSpinBoxWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsDoubleEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsDoubleSpinBoxWrapper.__group__ = ['settings'] except NameError: pass try: - QgsSettingsColorEditorWidgetWrapper.__group__ = ['settings'] + QgsSettingsColorButtonWrapper.__group__ = ['settings'] except NameError: pass diff --git a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in index 08bf87e9b923..e4c9ffada89f 100644 --- a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in +++ b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in @@ -78,10 +78,10 @@ To be re-implemented to implemeent type specific configuration (e.g. opacity for typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase; -class QgsSettingsStringEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase +class QgsSettingsStringLineEditWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase { %Docstring(signature="appended") -This class is a factory of editor for string settings +This class is a factory of editor for string settings with a line edit .. versionadded:: 3.32 %End @@ -91,7 +91,7 @@ This class is a factory of editor for string settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryStringQLineEditQStringBase; %End public: - QgsSettingsStringEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsStringLineEditWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -115,12 +115,13 @@ Constructor }; + typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase; -class QgsSettingsBoolEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase +class QgsSettingsBoolCheckBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase { %Docstring(signature="appended") -This class is a factory of editor for boolean settings +This class is a factory of editor for boolean settings with a checkbox .. versionadded:: 3.32 %End @@ -130,7 +131,7 @@ This class is a factory of editor for boolean settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryBoolQCheckBoxboolBase; %End public: - QgsSettingsBoolEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsBoolCheckBoxWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -156,10 +157,10 @@ Constructor typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase; -class QgsSettingsIntegerEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase +class QgsSettingsIntegerSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase { %Docstring(signature="appended") -This class is a factory of editor for integer settings +This class is a factory of editor for integer settings with a spin box .. versionadded:: 3.32 %End @@ -169,7 +170,7 @@ This class is a factory of editor for integer settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryIntegerQSpinBoxintBase; %End public: - QgsSettingsIntegerEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsIntegerSpinBoxWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -196,10 +197,10 @@ Constructor typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase; -class QgsSettingsDoubleEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase +class QgsSettingsDoubleSpinBoxWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase { %Docstring(signature="appended") -This class is a factory of editor for double settings +This class is a factory of editor for double settings with a double spin box .. versionadded:: 3.32 %End @@ -209,7 +210,7 @@ This class is a factory of editor for double settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryDoubleQDoubleSpinBoxdoubleBase; %End public: - QgsSettingsDoubleEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsDoubleSpinBoxWrapper( QObject *parent = 0 ); %Docstring Constructor %End @@ -236,10 +237,10 @@ Constructor typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase; -class QgsSettingsColorEditorWidgetWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase +class QgsSettingsColorButtonWrapper : QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase { %Docstring(signature="appended") -This class is a factory of editor for color settings +This class is a factory of editor for color settings with a color button .. versionadded:: 3.32 %End @@ -249,7 +250,7 @@ This class is a factory of editor for color settings typedef QgsSettingsEditorWidgetWrapperTemplate QgsSettingsEditorWidgetWrapperTemplateQgsSettingsEntryColorQgsColorButtonQColorBase; %End public: - QgsSettingsColorEditorWidgetWrapper( QObject *parent = 0 ); + QgsSettingsColorButtonWrapper( QObject *parent = 0 ); %Docstring Constructor %End diff --git a/src/gui/settings/qgssettingseditorwidgetregistry.cpp b/src/gui/settings/qgssettingseditorwidgetregistry.cpp index 97eb876abe9e..fd4872ae69d9 100644 --- a/src/gui/settings/qgssettingseditorwidgetregistry.cpp +++ b/src/gui/settings/qgssettingseditorwidgetregistry.cpp @@ -29,11 +29,11 @@ QgsSettingsEditorWidgetRegistry::QgsSettingsEditorWidgetRegistry() { - addWrapper( new QgsSettingsStringEditorWidgetWrapper() ); - addWrapper( new QgsSettingsBoolEditorWidgetWrapper() ); - addWrapper( new QgsSettingsIntegerEditorWidgetWrapper() ); - addWrapper( new QgsSettingsDoubleEditorWidgetWrapper() ); - addWrapper( new QgsSettingsColorEditorWidgetWrapper() ); + addWrapper( new QgsSettingsStringLineEditWrapper() ); + addWrapper( new QgsSettingsBoolCheckBoxWrapper() ); + addWrapper( new QgsSettingsIntegerSpinBoxWrapper() ); + addWrapper( new QgsSettingsDoubleSpinBoxWrapper() ); + addWrapper( new QgsSettingsColorButtonWrapper() ); // enum #if defined( HAVE_QTSERIALPORT ) diff --git a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp index ebe5706da57a..404fcf3f17c7 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp +++ b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.cpp @@ -27,12 +27,12 @@ // String // ******* -QString QgsSettingsStringEditorWidgetWrapper::id() const +QString QgsSettingsStringLineEditWrapper::id() const { return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast( Qgis::SettingsType::String ) ) ); } -bool QgsSettingsStringEditorWidgetWrapper::setWidgetValue( const QString &value ) const +bool QgsSettingsStringLineEditWrapper::setWidgetValue( const QString &value ) const { if ( mEditor ) { @@ -46,7 +46,7 @@ bool QgsSettingsStringEditorWidgetWrapper::setWidgetValue( const QString &value return false; } -void QgsSettingsStringEditorWidgetWrapper::enableAutomaticUpdatePrivate() +void QgsSettingsStringLineEditWrapper::enableAutomaticUpdatePrivate() { QObject::connect( this->mEditor, &QLineEdit::textChanged, this, [ = ]( const QString & text ) { @@ -54,7 +54,7 @@ void QgsSettingsStringEditorWidgetWrapper::enableAutomaticUpdatePrivate() } ); } -bool QgsSettingsStringEditorWidgetWrapper::setSettingFromWidget() const +bool QgsSettingsStringLineEditWrapper::setSettingFromWidget() const { if ( mEditor ) { @@ -68,7 +68,7 @@ bool QgsSettingsStringEditorWidgetWrapper::setSettingFromWidget() const return false; } -QString QgsSettingsStringEditorWidgetWrapper::valueFromWidget() const +QString QgsSettingsStringLineEditWrapper::valueFromWidget() const { if ( mEditor ) { @@ -85,12 +85,12 @@ QString QgsSettingsStringEditorWidgetWrapper::valueFromWidget() const // Boolean // ******* -QString QgsSettingsBoolEditorWidgetWrapper::id() const +QString QgsSettingsBoolCheckBoxWrapper::id() const { return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast( Qgis::SettingsType::Bool ) ) ); } -bool QgsSettingsBoolEditorWidgetWrapper::setWidgetValue( const bool &value ) const +bool QgsSettingsBoolCheckBoxWrapper::setWidgetValue( const bool &value ) const { if ( mEditor ) { @@ -104,7 +104,7 @@ bool QgsSettingsBoolEditorWidgetWrapper::setWidgetValue( const bool &value ) con return false; } -void QgsSettingsBoolEditorWidgetWrapper::enableAutomaticUpdatePrivate() +void QgsSettingsBoolCheckBoxWrapper::enableAutomaticUpdatePrivate() { QObject::connect( this->mEditor, &QCheckBox::clicked, this, [ = ]( bool checked ) { @@ -112,7 +112,7 @@ void QgsSettingsBoolEditorWidgetWrapper::enableAutomaticUpdatePrivate() } ); } -bool QgsSettingsBoolEditorWidgetWrapper::setSettingFromWidget() const +bool QgsSettingsBoolCheckBoxWrapper::setSettingFromWidget() const { if ( mEditor ) { @@ -126,7 +126,7 @@ bool QgsSettingsBoolEditorWidgetWrapper::setSettingFromWidget() const return false; } -bool QgsSettingsBoolEditorWidgetWrapper::valueFromWidget() const +bool QgsSettingsBoolCheckBoxWrapper::valueFromWidget() const { if ( mEditor ) @@ -145,12 +145,12 @@ bool QgsSettingsBoolEditorWidgetWrapper::valueFromWidget() const // Integer // ******* -QString QgsSettingsIntegerEditorWidgetWrapper::id() const +QString QgsSettingsIntegerSpinBoxWrapper::id() const { return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast( Qgis::SettingsType::Integer ) ) ); } -bool QgsSettingsIntegerEditorWidgetWrapper::setWidgetValue( const int &value ) const +bool QgsSettingsIntegerSpinBoxWrapper::setWidgetValue( const int &value ) const { if ( mEditor ) { @@ -164,7 +164,7 @@ bool QgsSettingsIntegerEditorWidgetWrapper::setWidgetValue( const int &value ) c return false; } -void QgsSettingsIntegerEditorWidgetWrapper::enableAutomaticUpdatePrivate() +void QgsSettingsIntegerSpinBoxWrapper::enableAutomaticUpdatePrivate() { QObject::connect( this->mEditor, qOverload( &QSpinBox::valueChanged ), this, [ = ]( int value ) { @@ -172,7 +172,7 @@ void QgsSettingsIntegerEditorWidgetWrapper::enableAutomaticUpdatePrivate() } ); } -bool QgsSettingsIntegerEditorWidgetWrapper::setSettingFromWidget() const +bool QgsSettingsIntegerSpinBoxWrapper::setSettingFromWidget() const { if ( mEditor ) { @@ -186,7 +186,7 @@ bool QgsSettingsIntegerEditorWidgetWrapper::setSettingFromWidget() const return false; } -int QgsSettingsIntegerEditorWidgetWrapper::valueFromWidget() const +int QgsSettingsIntegerSpinBoxWrapper::valueFromWidget() const { if ( mEditor ) { @@ -205,12 +205,12 @@ int QgsSettingsIntegerEditorWidgetWrapper::valueFromWidget() const // Double // ******* -QString QgsSettingsDoubleEditorWidgetWrapper::id() const +QString QgsSettingsDoubleSpinBoxWrapper::id() const { return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast( Qgis::SettingsType::Double ) ) ); } -bool QgsSettingsDoubleEditorWidgetWrapper::setWidgetValue( const double &value ) const +bool QgsSettingsDoubleSpinBoxWrapper::setWidgetValue( const double &value ) const { if ( mEditor ) { @@ -224,7 +224,7 @@ bool QgsSettingsDoubleEditorWidgetWrapper::setWidgetValue( const double &value ) return false; } -void QgsSettingsDoubleEditorWidgetWrapper::enableAutomaticUpdatePrivate() +void QgsSettingsDoubleSpinBoxWrapper::enableAutomaticUpdatePrivate() { QObject::connect( this->mEditor, qOverload( &QDoubleSpinBox::valueChanged ), this, [ = ]( double value ) { @@ -232,7 +232,7 @@ void QgsSettingsDoubleEditorWidgetWrapper::enableAutomaticUpdatePrivate() } ); } -bool QgsSettingsDoubleEditorWidgetWrapper::setSettingFromWidget() const +bool QgsSettingsDoubleSpinBoxWrapper::setSettingFromWidget() const { if ( mEditor ) { @@ -246,7 +246,7 @@ bool QgsSettingsDoubleEditorWidgetWrapper::setSettingFromWidget() const return false; } -double QgsSettingsDoubleEditorWidgetWrapper::valueFromWidget() const +double QgsSettingsDoubleSpinBoxWrapper::valueFromWidget() const { if ( mEditor ) { @@ -263,12 +263,12 @@ double QgsSettingsDoubleEditorWidgetWrapper::valueFromWidget() const // Color // ******* -QString QgsSettingsColorEditorWidgetWrapper::id() const +QString QgsSettingsColorButtonWrapper::id() const { return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast( Qgis::SettingsType::Color ) ) ); } -bool QgsSettingsColorEditorWidgetWrapper::setWidgetValue( const QColor &value ) const +bool QgsSettingsColorButtonWrapper::setWidgetValue( const QColor &value ) const { if ( mEditor ) { @@ -282,7 +282,7 @@ bool QgsSettingsColorEditorWidgetWrapper::setWidgetValue( const QColor &value ) return false; } -void QgsSettingsColorEditorWidgetWrapper::configureEditorPrivateImplementation() +void QgsSettingsColorButtonWrapper::configureEditorPrivateImplementation() { if ( mEditor ) { @@ -294,7 +294,7 @@ void QgsSettingsColorEditorWidgetWrapper::configureEditorPrivateImplementation() } } -void QgsSettingsColorEditorWidgetWrapper::enableAutomaticUpdatePrivate() +void QgsSettingsColorButtonWrapper::enableAutomaticUpdatePrivate() { QObject::connect( this->mEditor, &QgsColorButton::colorChanged, this, [ = ]( const QColor & color ) { @@ -302,7 +302,7 @@ void QgsSettingsColorEditorWidgetWrapper::enableAutomaticUpdatePrivate() } ); } -bool QgsSettingsColorEditorWidgetWrapper::setSettingFromWidget() const +bool QgsSettingsColorButtonWrapper::setSettingFromWidget() const { if ( mEditor ) { @@ -316,7 +316,7 @@ bool QgsSettingsColorEditorWidgetWrapper::setSettingFromWidget() const return false; } -QColor QgsSettingsColorEditorWidgetWrapper::valueFromWidget() const +QColor QgsSettingsColorButtonWrapper::valueFromWidget() const { if ( mEditor ) { diff --git a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h index d71e10cbfdb3..a45989648cd7 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h @@ -118,19 +118,19 @@ class QgsSettingsEditorWidgetWrapperTemplate : public QgsSettingsEditorWidgetWra /** * \ingroup gui - * \brief This class is a factory of editor for string settings + * \brief This class is a factory of editor for string settings with a line edit * * \since QGIS 3.32 */ -class GUI_EXPORT QgsSettingsStringEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate +class GUI_EXPORT QgsSettingsStringLineEditWrapper : public QgsSettingsEditorWidgetWrapperTemplate { Q_OBJECT public: //! Constructor - QgsSettingsStringEditorWidgetWrapper( QObject *parent = nullptr ) + QgsSettingsStringLineEditWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} - QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsStringEditorWidgetWrapper( parent );} + QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsStringLineEditWrapper( parent );} QString id() const override; @@ -143,21 +143,22 @@ class GUI_EXPORT QgsSettingsStringEditorWidgetWrapper : public QgsSettingsEditor void enableAutomaticUpdatePrivate() override; }; + /** * \ingroup gui - * \brief This class is a factory of editor for boolean settings + * \brief This class is a factory of editor for boolean settings with a checkbox * * \since QGIS 3.32 */ -class GUI_EXPORT QgsSettingsBoolEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate +class GUI_EXPORT QgsSettingsBoolCheckBoxWrapper : public QgsSettingsEditorWidgetWrapperTemplate { Q_OBJECT public: //! Constructor - QgsSettingsBoolEditorWidgetWrapper( QObject *parent = nullptr ) + QgsSettingsBoolCheckBoxWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} - QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsBoolEditorWidgetWrapper( parent );} + QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsBoolCheckBoxWrapper( parent );} QString id() const override; @@ -172,19 +173,19 @@ class GUI_EXPORT QgsSettingsBoolEditorWidgetWrapper : public QgsSettingsEditorWi /** * \ingroup gui - * \brief This class is a factory of editor for integer settings + * \brief This class is a factory of editor for integer settings with a spin box * * \since QGIS 3.32 */ -class GUI_EXPORT QgsSettingsIntegerEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate +class GUI_EXPORT QgsSettingsIntegerSpinBoxWrapper : public QgsSettingsEditorWidgetWrapperTemplate { Q_OBJECT public: //! Constructor - QgsSettingsIntegerEditorWidgetWrapper( QObject *parent = nullptr ) + QgsSettingsIntegerSpinBoxWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} - QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsIntegerEditorWidgetWrapper( parent );} + QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsIntegerSpinBoxWrapper( parent );} QString id() const override; @@ -200,19 +201,19 @@ class GUI_EXPORT QgsSettingsIntegerEditorWidgetWrapper : public QgsSettingsEdito /** * \ingroup gui - * \brief This class is a factory of editor for double settings + * \brief This class is a factory of editor for double settings with a double spin box * * \since QGIS 3.32 */ -class GUI_EXPORT QgsSettingsDoubleEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate +class GUI_EXPORT QgsSettingsDoubleSpinBoxWrapper : public QgsSettingsEditorWidgetWrapperTemplate { Q_OBJECT public: //! Constructor - QgsSettingsDoubleEditorWidgetWrapper( QObject *parent = nullptr ) + QgsSettingsDoubleSpinBoxWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} - QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsDoubleEditorWidgetWrapper( parent );} + QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsDoubleSpinBoxWrapper( parent );} QString id() const override; @@ -228,19 +229,19 @@ class GUI_EXPORT QgsSettingsDoubleEditorWidgetWrapper : public QgsSettingsEditor /** * \ingroup gui - * \brief This class is a factory of editor for color settings + * \brief This class is a factory of editor for color settings with a color button * * \since QGIS 3.32 */ -class GUI_EXPORT QgsSettingsColorEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate +class GUI_EXPORT QgsSettingsColorButtonWrapper : public QgsSettingsEditorWidgetWrapperTemplate { Q_OBJECT public: //! Constructor - QgsSettingsColorEditorWidgetWrapper( QObject *parent = nullptr ) + QgsSettingsColorButtonWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} - QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsColorEditorWidgetWrapper( parent );} + QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsColorButtonWrapper( parent );} QString id() const override;