diff --git a/python/core/auto_generated/settings/qgssettingsentry.sip.in b/python/core/auto_generated/settings/qgssettingsentry.sip.in index 30a76693312..407a9f3a302 100644 --- a/python/core/auto_generated/settings/qgssettingsentry.sip.in +++ b/python/core/auto_generated/settings/qgssettingsentry.sip.in @@ -347,13 +347,11 @@ class QgsSettingsEntryBaseTemplate : QgsSettingsEntryBase { %Docstring(signature="appended") -Base abstract class for settings entry which are passed by reference +Base abstract class for settings entries with typed get and set methods .. seealso:: :py:class:`QgsSettingsEntryBase` -.. seealso:: :py:class:`QgsSettingsEntryByValue` - -.. versionadded:: 3.26 +.. versionadded:: 3.32 %End %TypeHeaderCode diff --git a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in index be8d13ee48a..994d78ca4ac 100644 --- a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in +++ b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapper.sip.in @@ -85,8 +85,14 @@ The wrapper must be configured before calling this medthod protected: virtual QWidget *createEditorPrivate( QWidget *parent = 0 ) const = 0; +%Docstring +Creates the widgets +%End virtual bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) = 0; +%Docstring +Configures an existing widget +%End }; diff --git a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in index 0c573b3288e..0fdf25d3540 100644 --- a/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in +++ b/python/gui/auto_generated/settings/qgssettingseditorwidgetwrapperimpl.sip.in @@ -27,6 +27,9 @@ This class is a base factory of editor for settings %End public: QgsSettingsEditorWidgetWrapperTemplate( QObject *parent = 0 ); +%Docstring +Constructor +%End virtual QString id() const = 0; virtual bool setWidgetFromSetting() const; @@ -36,10 +39,16 @@ This class is a base factory of editor for settings virtual void setWidgetFromVariant( const QVariant &value ) const; virtual bool setWidgetValue( const U &value ) const = 0; +%Docstring +Sets the widget value +%End virtual QVariant variantValueFromWidget() const; virtual U valueFromWidget() const = 0; +%Docstring +Returns the widget value +%End V *editor() const; %Docstring @@ -83,6 +92,9 @@ typedef QgsSettingsEditorWidgetWrapperTemplateapplyChanges(); diff --git a/src/core/settings/qgssettingsentry.h b/src/core/settings/qgssettingsentry.h index 8faca8034d4..3c04924a106 100644 --- a/src/core/settings/qgssettingsentry.h +++ b/src/core/settings/qgssettingsentry.h @@ -353,13 +353,12 @@ class CORE_EXPORT QgsSettingsEntryBase /** * \ingroup core - * \class QgsSettingsEntryByReference + * \class QgsSettingsEntryBaseTemplate * - * \brief Base abstract class for settings entry which are passed by reference + * \brief Base abstract class for settings entries with typed get and set methods * \see QgsSettingsEntryBase - * \see QgsSettingsEntryByValue * - * \since QGIS 3.26 + * \since QGIS 3.32 */ template class QgsSettingsEntryBaseTemplate : public QgsSettingsEntryBase diff --git a/src/gui/settings/qgssettingseditorwidgetregistry.cpp b/src/gui/settings/qgssettingseditorwidgetregistry.cpp index 345173b3271..a5d11debbe2 100644 --- a/src/gui/settings/qgssettingseditorwidgetregistry.cpp +++ b/src/gui/settings/qgssettingseditorwidgetregistry.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - qgssettingsfactoryfactoryregistry.cpp + qgssettingseditorwidgetregistry.cpp --------------------- begin : April 2023 copyright : (C) 2023 by Denis Rouzaud @@ -66,7 +66,3 @@ QWidget *QgsSettingsEditorWidgetRegistry::createEditor( const QgsSettingsEntryBa else return nullptr; } - - - - diff --git a/src/gui/settings/qgssettingseditorwidgetregistry.h b/src/gui/settings/qgssettingseditorwidgetregistry.h index 4461c7e3a2a..03935c925c0 100644 --- a/src/gui/settings/qgssettingseditorwidgetregistry.h +++ b/src/gui/settings/qgssettingseditorwidgetregistry.h @@ -28,7 +28,7 @@ class QgsSettingsEditorWidgetWrapper; /** * \ingroup gui - * \brief This class manages editors for settings + * \brief This class manages editor widgets for settings * * \since QGIS 3.32 */ @@ -40,15 +40,15 @@ class GUI_EXPORT QgsSettingsEditorWidgetRegistry ~QgsSettingsEditorWidgetRegistry(); /** - * Adds a editor to the registry - * Returns FALSE if a editor with same id already exists. + * Adds an editor widget \a wrapper to the registry + * Returns FALSE if an editor widget with same id already exists. */ bool addWrapper( QgsSettingsEditorWidgetWrapper *wrapper SIP_TRANSFER ); - //! Returns a new instance of the editor for the given id + //! Returns a new instance of the editor widget for the given \a id QgsSettingsEditorWidgetWrapper *createWrapper( const QString &id, QObject *parent ) const; - //! Creates the editor for the given settings using the corresponding registered wrapper + //! Creates an editor widget for the given \a setting using the corresponding registered wrapper QWidget *createEditor( const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList, QWidget *parent = nullptr ) const SIP_FACTORY; //! Returns a map of all registered editors. diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.cpp b/src/gui/settings/qgssettingseditorwidgetwrapper.cpp index a15a90807b9..144ce2f7734 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.cpp +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.cpp @@ -44,7 +44,7 @@ QWidget *QgsSettingsEditorWidgetWrapper::createEditor( const QgsSettingsEntryBas if ( configureEditor( editor, setting, dynamicKeyPartList ) ) return editor; else - QgsDebugMsg( QStringLiteral( "editor could not be confiugured" ) ); + QgsDebugMsg( QStringLiteral( "editor could not be configured" ) ); return nullptr; } diff --git a/src/gui/settings/qgssettingseditorwidgetwrapper.h b/src/gui/settings/qgssettingseditorwidgetwrapper.h index 5ecf842d188..db6b85d49cf 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapper.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapper.h @@ -33,7 +33,7 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject { Q_OBJECT public: - //! Creates a wrapper from the definition stored in a widget created by createEditor() + //! Creates a wrapper from the definition stored in a \a widget created by createEditor() static QgsSettingsEditorWidgetWrapper *fromWidget( const QWidget *widget ) SIP_FACTORY; //! Constructor @@ -50,7 +50,7 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject //! Creates a new instance of the editor wrapper so it can be configured for a widget and a setting virtual QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const = 0; -//! Creates the editor for the given widget + //! Creates the editor widget for the given \a setting QWidget *createEditor( const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList = QStringList(), QWidget *parent = nullptr ); //! Configures the \a editor according the setting @@ -63,7 +63,7 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject virtual bool setWidgetFromSetting() const = 0; /** - * SDets the setting value from the widget value + * Sets the setting value from the widget value * The wrapper must be configured before calling this medthod */ virtual bool setSettingFromWidget() const = 0; @@ -75,15 +75,17 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject virtual QVariant variantValueFromWidget() const = 0; /** - * Sets the value of the widget + * Sets the \a value of the widget * The wrapper must be configured before calling this medthod */ virtual void setWidgetFromVariant( const QVariant &value ) const = 0; protected: + //! Creates the widgets virtual QWidget *createEditorPrivate( QWidget *parent = nullptr ) const = 0; + //! Configures an existing \a editor widget virtual bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) = 0; QStringList mDynamicKeyPartList; diff --git a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h index cda7b8dcad2..056225c6407 100644 --- a/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h +++ b/src/gui/settings/qgssettingseditorwidgetwrapperimpl.h @@ -45,6 +45,7 @@ template class GUI_EXPORT QgsSettingsEditorWidgetWrapperTemplate : public QgsSettingsEditorWidgetWrapper { public: + //! Constructor QgsSettingsEditorWidgetWrapperTemplate( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapper( parent ) {} @@ -66,6 +67,7 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapperTemplate : public QgsSettingsEdit setWidgetValue( mSetting->convertFromVariant( value ) ); } + //! Sets the widget value virtual bool setWidgetValue( const U &value ) const = 0; QVariant variantValueFromWidget() const override @@ -73,6 +75,7 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapperTemplate : public QgsSettingsEdit return valueFromWidget(); }; + //! Returns the widget value virtual U valueFromWidget() const = 0; //! Returns the editor @@ -120,6 +123,7 @@ class GUI_EXPORT QgsSettingsEditorWidgetWrapperTemplate : public QgsSettingsEdit class GUI_EXPORT QgsSettingsStringEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate { public: + //! Constructor QgsSettingsStringEditorWidgetWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} @@ -143,6 +147,7 @@ class GUI_EXPORT QgsSettingsStringEditorWidgetWrapper : public QgsSettingsEditor class GUI_EXPORT QgsSettingsBoolEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate { public: + //! Constructor QgsSettingsBoolEditorWidgetWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} @@ -166,6 +171,7 @@ class GUI_EXPORT QgsSettingsBoolEditorWidgetWrapper : public QgsSettingsEditorWi class GUI_EXPORT QgsSettingsIntegerEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate { public: + //! Constructor QgsSettingsIntegerEditorWidgetWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} @@ -190,6 +196,7 @@ class GUI_EXPORT QgsSettingsIntegerEditorWidgetWrapper : public QgsSettingsEdito class GUI_EXPORT QgsSettingsDoubleEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate { public: + //! Constructor QgsSettingsDoubleEditorWidgetWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} @@ -214,6 +221,7 @@ class GUI_EXPORT QgsSettingsDoubleEditorWidgetWrapper : public QgsSettingsEditor class GUI_EXPORT QgsSettingsColorEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate { public: + //! Constructor QgsSettingsColorEditorWidgetWrapper( QObject *parent = nullptr ) : QgsSettingsEditorWidgetWrapperTemplate( parent ) {} diff --git a/src/gui/settings/qgssettingstreemodel.h b/src/gui/settings/qgssettingstreemodel.h index 345ae907625..f645bb241d6 100644 --- a/src/gui/settings/qgssettingstreemodel.h +++ b/src/gui/settings/qgssettingstreemodel.h @@ -63,10 +63,10 @@ class GUI_EXPORT QgsSettingsTreeModelNodeData : public QObject void applyChanges(); //! Returns if the node is the root node - bool isRoot() const {return mParent == nullptr;} + bool isRoot() const { return mParent == nullptr; } //! Returns the dynamic key parts of the named list parent tree nodes - QStringList namedParentNodes() const {return mNamedParentNodes;} + QStringList namedParentNodes() const { return mNamedParentNodes; } //! Returns the children nodes of the node (setting or tree node) QList children() const {return mChildren;} @@ -86,7 +86,7 @@ class GUI_EXPORT QgsSettingsTreeModelNodeData : public QObject //! Returns the value of the node (setting or tree node) QVariant originalValue() const {return mOriginalValue;} - //! Sets the value of the setting node + //! Sets the \a value of the setting node bool setValue( const QVariant &value ); //! Returns if the setting exists (value is set) @@ -96,8 +96,8 @@ class GUI_EXPORT QgsSettingsTreeModelNodeData : public QObject bool isEdited() const {return mIsEdited;} /** - * Returns the setting of the node - * It returns a nullptr if the setting does not exist + * Returns a pointer to the setting of the node or NULLPTR if the + * setting does not exist. */ const QgsSettingsEntryBase *setting() const {return mSetting;} @@ -179,10 +179,11 @@ class GUI_EXPORT QgsSettingsTreeModel : public QAbstractItemModel ~QgsSettingsTreeModel(); + //! Apply pending changes in the model to the corresponding settings void applyChanges(); /** - * Returns settings tree node for given index. Returns root node for invalid index. + * Returns settings tree node for given \a index or the root node if the index is invalid. */ QgsSettingsTreeModelNodeData *index2node( const QModelIndex &index ) const SIP_SKIP; diff --git a/src/gui/settings/qgssettingstreewidget.h b/src/gui/settings/qgssettingstreewidget.h index d92276c9e1b..fde47cb5de2 100644 --- a/src/gui/settings/qgssettingstreewidget.h +++ b/src/gui/settings/qgssettingstreewidget.h @@ -39,7 +39,7 @@ class GUI_EXPORT QgsSettingsTreeWidget : public QWidget explicit QgsSettingsTreeWidget( QWidget *parent = nullptr ); - // Apply changes to settings value + //! Apply changes to settings value void applyChanges() const; private: