QGIS API Documentation
3.38.0-Grenoble (exported)
Loading...
Searching...
No Matches
src
gui
settings
qgssettingseditorwidgetwrapper.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgssettingseditorwidgetwrapper.cpp
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
17
#include "
qgssettingseditorwidgetwrapper.h
"
18
19
#include "
qgslogger.h
"
20
#include "
qgssettingsentry.h
"
21
22
#include <QWidget>
23
24
25
QgsSettingsEditorWidgetWrapper
*
QgsSettingsEditorWidgetWrapper::fromWidget
(
const
QWidget *widget )
26
{
27
QVariant editorDataVariant = widget->property(
"SETTING-EDITOR-WIDGET-WRAPPER"
);
28
if
( editorDataVariant.isValid() )
29
{
30
return
editorDataVariant.value<
QgsSettingsEditorWidgetWrapper
*>();
31
}
32
33
return
nullptr
;
34
}
35
36
QgsSettingsEditorWidgetWrapper::QgsSettingsEditorWidgetWrapper
( QObject *parent )
37
: QObject( parent )
38
{
39
}
40
41
QWidget *
QgsSettingsEditorWidgetWrapper::createEditor
(
const
QgsSettingsEntryBase
*setting,
const
QStringList &dynamicKeyPartList, QWidget *parent )
42
{
43
QWidget *editor =
createEditorPrivate
( parent );
44
if
(
configureEditor
( editor, setting, dynamicKeyPartList ) )
45
return
editor;
46
else
47
QgsDebugError
( QStringLiteral(
"editor could not be configured"
) );
48
return
nullptr
;
49
}
50
51
bool
QgsSettingsEditorWidgetWrapper::configureEditor
( QWidget *editor,
const
QgsSettingsEntryBase
*setting,
const
QStringList &dynamicKeyPartList )
52
{
53
mDynamicKeyPartList
= dynamicKeyPartList;
54
55
bool
ok =
configureEditorPrivate
( editor, setting );
56
57
if
( ok )
58
editor->setProperty(
"SETTING-EDITOR-WIDGET-WRAPPER"
, QVariant::fromValue(
this
) );
59
60
return
ok;
61
}
QgsSettingsEditorWidgetWrapper
Base class for settings editor wrappers.
Definition
qgssettingseditorwidgetwrapper.h:33
QgsSettingsEditorWidgetWrapper::fromWidget
static QgsSettingsEditorWidgetWrapper * fromWidget(const QWidget *widget)
Creates a wrapper from the definition stored in a widget created by createEditor()
Definition
qgssettingseditorwidgetwrapper.cpp:25
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:41
QgsSettingsEditorWidgetWrapper::mDynamicKeyPartList
QStringList mDynamicKeyPartList
Definition
qgssettingseditorwidgetwrapper.h:91
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:51
QgsSettingsEditorWidgetWrapper::configureEditorPrivate
virtual bool configureEditorPrivate(QWidget *editor, const QgsSettingsEntryBase *setting)=0
Configures an existing editor widget.
QgsSettingsEditorWidgetWrapper::QgsSettingsEditorWidgetWrapper
QgsSettingsEditorWidgetWrapper(QObject *parent=nullptr)
Constructor.
Definition
qgssettingseditorwidgetwrapper.cpp:36
QgsSettingsEntryBase
Represent settings entry and provides methods for reading and writing settings values.
Definition
qgssettingsentry.h:45
qgslogger.h
QgsDebugError
#define QgsDebugError(str)
Definition
qgslogger.h:38
qgssettingseditorwidgetwrapper.h
qgssettingsentry.h
Generated on Thu Jun 27 2024 20:32:18 for QGIS API Documentation by
1.9.8