Skip to content

Commit effbfc2

Browse files
committedApr 23, 2023
add base class and implementation of wrappers for settings editor widgets
1 parent 7872ddb commit effbfc2

File tree

4 files changed

+735
-0
lines changed

4 files changed

+735
-0
lines changed
 
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/***************************************************************************
2+
qgssettingseditorwidgetwrapper.cpp
3+
--------------------------------------
4+
Date : February 2023
5+
Copyright : (C) 2023 by Denis Rouzaud
6+
Email : denis@opengis.ch
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+
QgsDebugMsg( QStringLiteral( "editor could not be confiugured" ) );
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+
}
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
/***************************************************************************
2+
qgssettingseditorwidgetwrapper.h
3+
--------------------------------------
4+
Date : February 2023
5+
Copyright : (C) 2023 by Denis Rouzaud
6+
Email : denis@opengis.ch
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+
24+
class QgsSettingsEntryBase;
25+
26+
/**
27+
* \ingroup gui
28+
* \brief Base class for settings editor wrappers
29+
*
30+
* \since QGIS 3.32
31+
*/
32+
class GUI_EXPORT QgsSettingsEditorWidgetWrapper : public QObject
33+
{
34+
Q_OBJECT
35+
public:
36+
//! Creates a wrapper from the definition stored in a widget created by createEditor()
37+
static QgsSettingsEditorWidgetWrapper *fromWidget( const QWidget *widget ) SIP_FACTORY;
38+
39+
//! Constructor
40+
QgsSettingsEditorWidgetWrapper( QObject *parent = nullptr );
41+
42+
virtual ~QgsSettingsEditorWidgetWrapper() = default;
43+
44+
/**
45+
* This id of the type of settings it handles
46+
* \note This mostly correspond to the content of Qgis::SettingsType but it's a string since custom Python implementation are possible.
47+
*/
48+
virtual QString id() const = 0;
49+
50+
//! Creates a new instance of the editor wrapper so it can be configured for a widget and a setting
51+
virtual QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const = 0;
52+
53+
//! Creates the editor for the given widget
54+
QWidget *createEditor( const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList = QStringList(), QWidget *parent = nullptr );
55+
56+
//! Configures the \a editor according the setting
57+
bool configureEditor( QWidget *editor, const QgsSettingsEntryBase *setting, const QStringList &dynamicKeyPartList = QStringList() );
58+
59+
/**
60+
* Sets the widget value from the setting value
61+
* The wrapper must be configured before calling this medthod
62+
*/
63+
virtual bool setWidgetFromSetting() const = 0;
64+
65+
/**
66+
* SDets the setting value from the widget value
67+
* The wrapper must be configured before calling this medthod
68+
*/
69+
virtual bool setSettingFromWidget() const = 0;
70+
71+
/**
72+
* Returns the value from the widget as a variant
73+
* The wrapper must be configured before calling this medthod
74+
*/
75+
virtual QVariant variantValueFromWidget() const = 0;
76+
77+
/**
78+
* Sets the value of the widget
79+
* The wrapper must be configured before calling this medthod
80+
*/
81+
virtual void setWidgetFromVariant( const QVariant &value ) const = 0;
82+
83+
84+
protected:
85+
virtual QWidget *createEditorPrivate( QWidget *parent = nullptr ) const = 0;
86+
87+
virtual bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) = 0;
88+
89+
QStringList mDynamicKeyPartList;
90+
};
91+
92+
93+
94+
#endif // QGSSETTINGSEDITORWIDGETWRAPPER_H
Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
/***************************************************************************
2+
qgssettingseditorwidgetwrapperimpl.cpp
3+
--------------------------------------
4+
Date : February 2023
5+
Copyright : (C) 2023 by Denis Rouzaud
6+
Email : denis@opengis.ch
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 "qgssettingseditorwidgetwrapperimpl.h"
18+
#include "qgslogger.h"
19+
#include "qgssettingsentryimpl.h"
20+
#include "qgscolorbutton.h"
21+
22+
#include <QLineEdit>
23+
#include <QCheckBox>
24+
25+
26+
// *******
27+
// String
28+
// *******
29+
30+
QString QgsSettingsStringEditorWidgetWrapper::id() const
31+
{
32+
return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast<int>( Qgis::SettingsType::String ) ) );
33+
}
34+
35+
bool QgsSettingsStringEditorWidgetWrapper::setWidgetValue( const QString &value ) const
36+
{
37+
if ( mEditor )
38+
{
39+
mEditor->setText( value );
40+
return true;
41+
}
42+
else
43+
{
44+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
45+
}
46+
return false;
47+
}
48+
49+
bool QgsSettingsStringEditorWidgetWrapper::setSettingFromWidget() const
50+
{
51+
if ( mEditor )
52+
{
53+
mSetting->setValue( mEditor->text(), mDynamicKeyPartList );
54+
return true;
55+
}
56+
else
57+
{
58+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
59+
}
60+
return false;
61+
}
62+
63+
QString QgsSettingsStringEditorWidgetWrapper::valueFromWidget() const
64+
{
65+
if ( mEditor )
66+
{
67+
return mEditor->text();
68+
}
69+
else
70+
{
71+
QgsDebugMsg( QString( "editor is not set, returning a non-existing value" ) );
72+
}
73+
return QString();
74+
}
75+
76+
// *******
77+
// Boolean
78+
// *******
79+
80+
QString QgsSettingsBoolEditorWidgetWrapper::id() const
81+
{
82+
return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast<int>( Qgis::SettingsType::Bool ) ) );
83+
}
84+
85+
bool QgsSettingsBoolEditorWidgetWrapper::setWidgetValue( const bool &value ) const
86+
{
87+
if ( mEditor )
88+
{
89+
mEditor->setChecked( value );
90+
return true;
91+
}
92+
else
93+
{
94+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
95+
}
96+
return false;
97+
}
98+
99+
bool QgsSettingsBoolEditorWidgetWrapper::setSettingFromWidget() const
100+
{
101+
if ( mEditor )
102+
{
103+
mSetting->setValue( mEditor->isChecked(), mDynamicKeyPartList );
104+
return true;
105+
}
106+
else
107+
{
108+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
109+
}
110+
return false;
111+
}
112+
113+
bool QgsSettingsBoolEditorWidgetWrapper::valueFromWidget() const
114+
{
115+
116+
if ( mEditor )
117+
{
118+
return mEditor->isChecked();
119+
}
120+
else
121+
{
122+
QgsDebugMsg( QString( "editor is not set, returning a non-existing value" ) );
123+
}
124+
return false;
125+
}
126+
127+
128+
// *******
129+
// Integer
130+
// *******
131+
132+
QString QgsSettingsIntegerEditorWidgetWrapper::id() const
133+
{
134+
return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast<int>( Qgis::SettingsType::Integer ) ) );
135+
}
136+
137+
bool QgsSettingsIntegerEditorWidgetWrapper::setWidgetValue( const int &value ) const
138+
{
139+
if ( mEditor )
140+
{
141+
mEditor->setValue( value );
142+
return true;
143+
}
144+
else
145+
{
146+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
147+
}
148+
return false;
149+
}
150+
151+
bool QgsSettingsIntegerEditorWidgetWrapper::setSettingFromWidget() const
152+
{
153+
if ( mEditor )
154+
{
155+
mSetting->setValue( mEditor->value(), mDynamicKeyPartList );
156+
return true;
157+
}
158+
else
159+
{
160+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
161+
}
162+
return false;
163+
}
164+
165+
int QgsSettingsIntegerEditorWidgetWrapper::valueFromWidget() const
166+
{
167+
if ( mEditor )
168+
{
169+
return mEditor->value();
170+
}
171+
else
172+
{
173+
QgsDebugMsg( QString( "editor is not set, returning a non-existing value" ) );
174+
}
175+
return std::numeric_limits<int>::quiet_NaN();
176+
}
177+
178+
179+
180+
// *******
181+
// Double
182+
// *******
183+
184+
QString QgsSettingsDoubleEditorWidgetWrapper::id() const
185+
{
186+
return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast<int>( Qgis::SettingsType::Double ) ) );
187+
}
188+
189+
bool QgsSettingsDoubleEditorWidgetWrapper::setWidgetValue( const double &value ) const
190+
{
191+
if ( mEditor )
192+
{
193+
mEditor->setValue( value );
194+
return true;
195+
}
196+
else
197+
{
198+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
199+
}
200+
return false;
201+
}
202+
203+
bool QgsSettingsDoubleEditorWidgetWrapper::setSettingFromWidget() const
204+
{
205+
if ( mEditor )
206+
{
207+
mSetting->setValue( mEditor->value(), mDynamicKeyPartList );
208+
return true;
209+
}
210+
else
211+
{
212+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
213+
}
214+
return false;
215+
}
216+
217+
double QgsSettingsDoubleEditorWidgetWrapper::valueFromWidget() const
218+
{
219+
if ( mEditor )
220+
{
221+
return mEditor->value();
222+
}
223+
else
224+
{
225+
QgsDebugMsg( QString( "editor is not set, returning a non-existing value" ) );
226+
}
227+
return std::numeric_limits<double>::quiet_NaN();
228+
}
229+
230+
// *******
231+
// Color
232+
// *******
233+
234+
QString QgsSettingsColorEditorWidgetWrapper::id() const
235+
{
236+
return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast<int>( Qgis::SettingsType::Color ) ) );
237+
}
238+
239+
bool QgsSettingsColorEditorWidgetWrapper::setWidgetValue( const QColor &value ) const
240+
{
241+
if ( mEditor )
242+
{
243+
mEditor->setColor( value );
244+
return true;
245+
}
246+
else
247+
{
248+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
249+
}
250+
return false;
251+
}
252+
253+
bool QgsSettingsColorEditorWidgetWrapper::setSettingFromWidget() const
254+
{
255+
if ( mEditor )
256+
{
257+
mSetting->setValue( mEditor->color(), mDynamicKeyPartList );
258+
return true;
259+
}
260+
else
261+
{
262+
QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
263+
}
264+
return false;
265+
}
266+
267+
QColor QgsSettingsColorEditorWidgetWrapper::valueFromWidget() const
268+
{
269+
if ( mEditor )
270+
{
271+
return mEditor->color();
272+
}
273+
else
274+
{
275+
QgsDebugMsg( QString( "editor is not set, returning a non-existing value" ) );
276+
}
277+
return QColor();
278+
}
279+
280+
// *******
281+
// StringList
282+
// *******
283+
284+
//QString QgsSettingsStringListEditorWidgetWrapper::id() const
285+
//{
286+
// return QString::fromUtf8( sSettingsTypeMetaEnum.valueToKey( static_cast<int>( Qgis::SettingsType::StringList ) ) );
287+
//}
288+
289+
//bool QgsSettingsStringListEditorWidgetWrapper::setWidgetFromSetting() const
290+
//{
291+
// if ( mEditor )
292+
// {
293+
// mEditor->setValue( mSetting->value( mDynamicKeyPartList ) );
294+
// return true;
295+
// }
296+
// else
297+
// {
298+
// QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
299+
// }
300+
// return false;
301+
//}
302+
303+
//bool QgsSettingsStringListEditorWidgetWrapper::setSettingFromWidget() const
304+
//{
305+
// if ( mEditor )
306+
// {
307+
// mSetting->setValue( mEditor->value(), mDynamicKeyPartList );
308+
// return true;
309+
// }
310+
// else
311+
// {
312+
// QgsDebugMsg( QStringLiteral( "Settings editor not set for %1" ).arg( mSetting->definitionKey() ) );
313+
// }
314+
// return false;
315+
//}
316+
317+
//QVariant QgsSettingsStringListEditorWidgetWrapper::valueFromWidget() const
318+
//{
319+
// if ( mEditor )
320+
// {
321+
// return mEditor->value();
322+
// }
323+
// else
324+
// {
325+
// QgsDebugMsg(QString("editor is not set, returning a non-existing value"));
326+
// }
327+
// return QStringList();
328+
//}
Lines changed: 252 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,252 @@
1+
/***************************************************************************
2+
qgssettingseditorwidgetwrapperimpl.h
3+
--------------------------------------
4+
Date : February 2023
5+
Copyright : (C) 2023 by Denis Rouzaud
6+
Email : denis@opengis.ch
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 QGSSETTINGSEDITORWIDGETWRAPPERIMPL_H
17+
#define QGSSETTINGSEDITORWIDGETWRAPPERIMPL_H
18+
19+
#include <QColor>
20+
21+
#include "qgis_gui.h"
22+
#include "qgssettingseditorwidgetwrapper.h"
23+
#include "qgslogger.h"
24+
25+
#include "qgssettingsentryimpl.h"
26+
#include "qgscolorbutton.h"
27+
#include <QLineEdit>
28+
#include <QCheckBox>
29+
#include <QSpinBox>
30+
#include <QDoubleSpinBox>
31+
#include <QTableWidget>
32+
33+
34+
//TODO variant map, enum
35+
36+
class QgsColorButton;
37+
38+
/**
39+
* \ingroup gui
40+
* \brief This class is a base factory of editor for settings
41+
*
42+
* \since QGIS 3.32
43+
*/
44+
template<class T, class V, class U>
45+
class GUI_EXPORT QgsSettingsEditorWidgetWrapperTemplate : public QgsSettingsEditorWidgetWrapper
46+
{
47+
public:
48+
QgsSettingsEditorWidgetWrapperTemplate( QObject *parent = nullptr )
49+
: QgsSettingsEditorWidgetWrapper( parent ) {}
50+
51+
virtual QString id() const override = 0;
52+
53+
virtual bool setWidgetFromSetting() const override
54+
{
55+
if ( mSetting )
56+
return setWidgetValue( mSetting->value( mDynamicKeyPartList ) );
57+
58+
QgsDebugMsg( "editor is not configured" );
59+
return false;
60+
}
61+
62+
virtual bool setSettingFromWidget() const override = 0;
63+
64+
void setWidgetFromVariant( const QVariant &value ) const override
65+
{
66+
setWidgetValue( mSetting->convertFromVariant( value ) );
67+
}
68+
69+
virtual bool setWidgetValue( const U &value ) const = 0;
70+
71+
QVariant variantValueFromWidget() const override
72+
{
73+
return valueFromWidget();
74+
};
75+
76+
virtual U valueFromWidget() const = 0;
77+
78+
//! Returns the editor
79+
V *editor() const {return mEditor;}
80+
81+
//! Returns the setting
82+
const T *setting() const {return mSetting;}
83+
84+
virtual QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override = 0;
85+
86+
protected:
87+
virtual QWidget *createEditorPrivate( QWidget *parent = nullptr ) const override
88+
{
89+
V *editor = new V( parent );
90+
editor->setAutoFillBackground( true );
91+
return editor;
92+
}
93+
94+
bool configureEditorPrivate( QWidget *editor, const QgsSettingsEntryBase *setting ) override
95+
{
96+
mSetting = dynamic_cast<const T *>( setting );
97+
mEditor = qobject_cast<V *>( editor );
98+
if ( mEditor )
99+
{
100+
configureEditorPrivateImplementation();
101+
return true;
102+
}
103+
return false;
104+
}
105+
106+
virtual void configureEditorPrivateImplementation() {}
107+
108+
const T *mSetting = nullptr;
109+
V *mEditor = nullptr;
110+
};
111+
112+
113+
/**
114+
* \ingroup gui
115+
* \brief This class is a factory of editor for string settings
116+
*
117+
* \since QGIS 3.32
118+
*/
119+
class GUI_EXPORT QgsSettingsStringEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryString, QLineEdit, QString>
120+
{
121+
public:
122+
QgsSettingsStringEditorWidgetWrapper( QObject *parent = nullptr )
123+
: QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryString, QLineEdit, QString>( parent ) {}
124+
125+
QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsStringEditorWidgetWrapper( parent );}
126+
127+
QString id() const override;
128+
129+
bool setSettingFromWidget() const override;
130+
131+
QString valueFromWidget() const override;
132+
133+
bool setWidgetValue( const QString &value ) const override;
134+
};
135+
136+
/**
137+
* \ingroup gui
138+
* \brief This class is a factory of editor for boolean settings
139+
*
140+
* \since QGIS 3.32
141+
*/
142+
class GUI_EXPORT QgsSettingsBoolEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryBool, QCheckBox, bool>
143+
{
144+
public:
145+
QgsSettingsBoolEditorWidgetWrapper( QObject *parent = nullptr )
146+
: QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryBool, QCheckBox, bool>( parent ) {}
147+
148+
QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsBoolEditorWidgetWrapper( parent );}
149+
150+
QString id() const override;
151+
152+
bool setSettingFromWidget() const override;
153+
154+
bool valueFromWidget() const override;
155+
156+
bool setWidgetValue( const bool &value ) const override;
157+
};
158+
159+
/**
160+
* \ingroup gui
161+
* \brief This class is a factory of editor for integer settings
162+
*
163+
* \since QGIS 3.32
164+
*/
165+
class GUI_EXPORT QgsSettingsIntegerEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryInteger, QSpinBox, int>
166+
{
167+
public:
168+
QgsSettingsIntegerEditorWidgetWrapper( QObject *parent = nullptr )
169+
: QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryInteger, QSpinBox, int>( parent ) {}
170+
171+
QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsIntegerEditorWidgetWrapper( parent );}
172+
173+
QString id() const override;
174+
175+
bool setSettingFromWidget() const override;
176+
177+
int valueFromWidget() const override;
178+
179+
bool setWidgetValue( const int &value ) const override;
180+
};
181+
182+
183+
/**
184+
* \ingroup gui
185+
* \brief This class is a factory of editor for double settings
186+
*
187+
* \since QGIS 3.32
188+
*/
189+
class GUI_EXPORT QgsSettingsDoubleEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryDouble, QDoubleSpinBox, double>
190+
{
191+
public:
192+
QgsSettingsDoubleEditorWidgetWrapper( QObject *parent = nullptr )
193+
: QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryDouble, QDoubleSpinBox, double>( parent ) {}
194+
195+
QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsDoubleEditorWidgetWrapper( parent );}
196+
197+
QString id() const override;
198+
199+
bool setSettingFromWidget() const override;
200+
201+
double valueFromWidget() const override;
202+
203+
bool setWidgetValue( const double &value ) const override;
204+
};
205+
206+
207+
/**
208+
* \ingroup gui
209+
* \brief This class is a factory of editor for color settings
210+
*
211+
* \since QGIS 3.32
212+
*/
213+
class GUI_EXPORT QgsSettingsColorEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryColor, QgsColorButton, QColor>
214+
{
215+
public:
216+
QgsSettingsColorEditorWidgetWrapper( QObject *parent = nullptr )
217+
: QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryColor, QgsColorButton, QColor>( parent ) {}
218+
219+
QgsSettingsEditorWidgetWrapper *createWrapper( QObject *parent = nullptr ) const override {return new QgsSettingsColorEditorWidgetWrapper( parent );}
220+
221+
QString id() const override;
222+
223+
bool setSettingFromWidget() const override;
224+
225+
QColor valueFromWidget() const override;
226+
227+
bool setWidgetValue( const QColor &value ) const override;
228+
};
229+
230+
///**
231+
// * \ingroup gui
232+
// * \brief This class is a factory of editor for boolean settings
233+
// *
234+
// * \since QGIS 3.32
235+
// */
236+
//class GUI_EXPORT QgsSettingsStringListEditorWidgetWrapper : public QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryStringList, QTableWidget, QStringList>
237+
//{
238+
// public:
239+
// QgsSettingsStringListEditorWidgetWrapper()
240+
// : QgsSettingsEditorWidgetWrapperTemplate<QgsSettingsEntryStringList, QTableWidget, QStringList>() {}
241+
242+
// QString id() const override;
243+
244+
// bool setWidgetFromSetting() const override;
245+
246+
// bool setSettingFromWidget() const override;
247+
248+
// QStringList valueFromWidget() const override;
249+
//};
250+
251+
252+
#endif // QGSSETTINGSEDITORWIDGETWRAPPERIMPL_H

0 commit comments

Comments
 (0)
Please sign in to comment.