QGIS API Documentation 3.39.0-Master (d85f3c2a281)
Loading...
Searching...
No Matches
qgssettingseditorwidgetwrapper.h
Go to the documentation of this file.
1/***************************************************************************
2 qgssettingseditorwidgetwrapper.h
3 --------------------------------------
4 Date : February 2023
5 Copyright : (C) 2023 by Denis Rouzaud
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSSETTINGSEDITORWIDGETWRAPPER_H
17#define QGSSETTINGSEDITORWIDGETWRAPPER_H
18
19#include <QVariant>
20
21#include "qgis_sip.h"
22#include "qgis_gui.h"
23
25
26class QDialog;
27
34class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject
35{
36 Q_OBJECT
37 public:
39 static QgsSettingsEditorWidgetWrapper *fromWidget( const QWidget *widget ) SIP_FACTORY;
40
42 QgsSettingsEditorWidgetWrapper( QObject *parent = nullptr );
43
45
50 virtual QString id() const = 0;
51
53 virtual QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const = 0;
54
56 QWidget *createEditor( const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList = QStringList(), QWidget *parent = nullptr );
57
59 bool configureEditor( QWidget *editor, const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList = QStringList() );
60
65 virtual bool setWidgetFromSetting() const = 0;
66
71 virtual bool setSettingFromWidget() const = 0;
72
77 virtual QVariant variantValueFromWidget() const = 0;
78
83 virtual void setWidgetFromVariant( const QVariant &value ) const = 0;
84
95 void configureAutomaticUpdate( QDialog *dialog = nullptr );
96
97
98 protected:
100 virtual QWidget *createEditorPrivate( QWidget *parent = nullptr ) const = 0;
101
103 virtual bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) = 0;
104
111
113};
114
115
116
117#endif // QGSSETTINGSEDITORWIDGETWRAPPER_H
Base class for settings editor wrappers.
virtual bool setWidgetFromSetting() const =0
Sets the widget value from the setting value The wrapper must be configured before calling this medth...
virtual bool setSettingFromWidget() const =0
Sets the setting value from the widget value The wrapper must be configured before calling this medth...
virtual QgsSettingsEditorWidgetWrapper * createWrapper(QObject *parent=nullptr) const =0
Creates a new instance of the editor wrapper so it can be configured for a widget and a setting.
virtual void setWidgetFromVariant(const QVariant &value) const =0
Sets the value of the widget The wrapper must be configured before calling this medthod.
virtual QWidget * createEditorPrivate(QWidget *parent=nullptr) const =0
Creates the widgets.
virtual void enableAutomaticUpdatePrivate()=0
Enables automatic update, which causes the setting to be updated immediately when the widget value is...
virtual bool configureEditorPrivate(QWidget *editor, const QgsSettingsEntryBase *setting)=0
Configures an existing editor widget.
virtual QString id() const =0
This id of the type of settings it handles.
virtual QVariant variantValueFromWidget() const =0
Returns the value from the widget as a variant The wrapper must be configured before calling this med...
virtual ~QgsSettingsEditorWidgetWrapper()=default
Represent settings entry and provides methods for reading and writing settings values.
#define SIP_FACTORY
Definition qgis_sip.h:76