QGIS API Documentation
3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
src
gui
settings
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
6
Email :
[email protected]
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 "qgis_gui.h"
20
#include "
qgis_sip.h
"
21
22
#include <QVariant>
23
24
class
QgsSettingsEntryBase
;
25
26
class
QDialog;
27
34
class
GUI_EXPORT
QgsSettingsEditorWidgetWrapper
:
public
QObject
35
{
36
Q_OBJECT
37
public
:
39
static
QgsSettingsEditorWidgetWrapper
*
fromWidget
(
const
QWidget *widget );
40
42
QgsSettingsEditorWidgetWrapper
( QObject *parent =
nullptr
);
43
44
~QgsSettingsEditorWidgetWrapper
()
override
=
default
;
45
50
virtual
QString
id
()
const
= 0;
51
53
virtual
QgsSettingsEditorWidgetWrapper
*
createWrapper
( QObject *parent =
nullptr
)
const
= 0
SIP_FACTORY
;
54
56
QWidget *
createEditor
(
const
QgsSettingsEntryBase
*setting,
const
QStringList &
dynamicKeyPartList
= QStringList(), QWidget *parent =
nullptr
)
SIP_TRANSFERBACK
;
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
bool
setWidgetFromVariant
( const QVariant &value ) const = 0;
84
95
void
configureAutomaticUpdate
( QDialog *dialog =
nullptr
);
96
101
QStringList
dynamicKeyPartList
()
const
{
return
mDynamicKeyPartList
; }
102
103
104
protected
:
106
virtual
QWidget *
createEditorPrivate
( QWidget *parent =
nullptr
)
const
= 0
SIP_TRANSFERBACK
;
107
109
virtual
bool
configureEditorPrivate
( QWidget *editor
SIP_TRANSFERBACK
,
const
QgsSettingsEntryBase
*setting
SIP_KEEPREFERENCE
) = 0;
110
116
virtual
void
enableAutomaticUpdatePrivate
() = 0;
117
118
QStringList
mDynamicKeyPartList
;
119
};
120
121
122
#endif
// QGSSETTINGSEDITORWIDGETWRAPPER_H
QgsSettingsEditorWidgetWrapper::setWidgetFromSetting
virtual bool setWidgetFromSetting() const =0
Sets the widget value from the setting value The wrapper must be configured before calling this medth...
QgsSettingsEditorWidgetWrapper::dynamicKeyPartList
QStringList dynamicKeyPartList() const
Returns the dynamic key parts.
Definition
qgssettingseditorwidgetwrapper.h:101
QgsSettingsEditorWidgetWrapper::fromWidget
static QgsSettingsEditorWidgetWrapper * fromWidget(const QWidget *widget)
Creates a wrapper from the definition stored in a widget created by createEditor().
Definition
qgssettingseditorwidgetwrapper.cpp:27
QgsSettingsEditorWidgetWrapper::setSettingFromWidget
virtual bool setSettingFromWidget() const =0
Sets the setting value from the widget value The wrapper must be configured before calling this medth...
QgsSettingsEditorWidgetWrapper::createWrapper
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.
QgsSettingsEditorWidgetWrapper::createEditor
QWidget * createEditor(const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList=QStringList(), QWidget *parent=nullptr)
Creates the editor widget for the given setting.
Definition
qgssettingseditorwidgetwrapper.cpp:43
QgsSettingsEditorWidgetWrapper::mDynamicKeyPartList
QStringList mDynamicKeyPartList
Definition
qgssettingseditorwidgetwrapper.h:118
QgsSettingsEditorWidgetWrapper::createEditorPrivate
virtual QWidget * createEditorPrivate(QWidget *parent=nullptr) const =0
Creates the widgets.
QgsSettingsEditorWidgetWrapper::configureEditor
bool configureEditor(QWidget *editor, const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList=QStringList())
Configures the editor according the setting.
Definition
qgssettingseditorwidgetwrapper.cpp:53
QgsSettingsEditorWidgetWrapper::enableAutomaticUpdatePrivate
virtual void enableAutomaticUpdatePrivate()=0
Enables automatic update, which causes the setting to be updated immediately when the widget value is...
QgsSettingsEditorWidgetWrapper::setWidgetFromVariant
virtual bool setWidgetFromVariant(const QVariant &value) const =0
Sets the value of the widget The wrapper must be configured before calling this medthod.
QgsSettingsEditorWidgetWrapper::configureEditorPrivate
virtual bool configureEditorPrivate(QWidget *editor, const QgsSettingsEntryBase *setting)=0
Configures an existing editor widget.
QgsSettingsEditorWidgetWrapper::id
virtual QString id() const =0
This id of the type of settings it handles.
QgsSettingsEditorWidgetWrapper::variantValueFromWidget
virtual QVariant variantValueFromWidget() const =0
Returns the value from the widget as a variant The wrapper must be configured before calling this med...
QgsSettingsEditorWidgetWrapper::configureAutomaticUpdate
void configureAutomaticUpdate(QDialog *dialog=nullptr)
Configure the settings update behavior when a widget value is changed.
Definition
qgssettingseditorwidgetwrapper.cpp:67
QgsSettingsEditorWidgetWrapper::~QgsSettingsEditorWidgetWrapper
~QgsSettingsEditorWidgetWrapper() override=default
QgsSettingsEditorWidgetWrapper::QgsSettingsEditorWidgetWrapper
QgsSettingsEditorWidgetWrapper(QObject *parent=nullptr)
Constructor.
Definition
qgssettingseditorwidgetwrapper.cpp:38
QgsSettingsEntryBase
Represents a settings entry and provides methods for reading and writing settings values.
Definition
qgssettingsentry.h:46
qgis_sip.h
SIP_KEEPREFERENCE
#define SIP_KEEPREFERENCE
Definition
qgis_sip.h:94
SIP_TRANSFERBACK
#define SIP_TRANSFERBACK
Definition
qgis_sip.h:48
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:84
Generated on
for QGIS API Documentation by
1.15.0