Perceptual Color
7#include "settingbase.h"
11#include <qfilesystemwatcher.h>
18#include <qstringliteral.h>
20#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
21#include <qtmetamacros.h>
23#include <qobjectdefs.h>
38class Setting final :
public SettingBase
42 virtual ~Setting()
override;
46 void setValue(
const T &newValue);
51 Setting(
const Setting &) =
delete;
52 Setting &operator=(
const Setting &) =
delete;
57 void updateFromQSettings();
60 friend class TestSetting;
91Setting<T>::Setting(
const QString &key, Settings *settings,
QObject *parent)
92 : SettingBase(key, settings, parent)
96 qRegisterMetaType<T>();
97#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
99 qRegisterMetaTypeStreamOperators<T>();
103 updateFromQSettings();
107 &Settings::updatedAfterFileChange,
109 &PerceptualColor::Setting<T>::updateFromQSettings
115Setting<T>::~Setting()
125void Setting<T>::updateFromQSettings()
137 const QVariant newValueVariant = underlyingQSettings()->
value(m_key);
138 const T newValue = newValueVariant.
value<T>();
139 if (newValue != m_value) {
141 Q_EMIT valueChanged();
148T Setting<T>::value()
const
157void Setting<T>::setValue(
const T &newValue)
159 if (newValue != m_value) {
161 const auto newVariant = QVariant::fromValue<T>(m_value);
162 underlyingQSettings()->setValue(m_key, newVariant);
163 Q_EMIT valueChanged();
The namespace of this library.
QObject * parent() const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:51:26 by
doxygen 1.10.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.