Perceptual Color

settingbase.h
1// SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
2// SPDX-License-Identifier: BSD-2-Clause OR MIT
3
4#ifndef SETTINGBASE_H
5#define SETTINGBASE_H
6
7#include <qglobal.h>
8#include <qobject.h>
9#include <qpointer.h>
10#include <qstring.h>
11
12#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
13#include <qtmetamacros.h>
14#else
15#include <qobjectdefs.h>
16#endif
17
18class QSettings;
19
20namespace PerceptualColor
21{
22
23class Settings;
24
25/** @internal
26 *
27 * @brief Base class for @ref Setting.
28 *
29 * @internal
30 *
31 * @note <a href="https://stackoverflow.com/a/63021891">The <tt>Q_OBJECT</tt>
32 * macro and templates cannot be combined.</a> Therefore,
33 * @ref SettingBase serves as a base class to provide
34 * signals for @ref Setting. */
35class SettingBase : public QObject
36{
38
39public:
40 virtual ~SettingBase() override;
41
43 /** @brief Notify signal for the value. */
44 void valueChanged();
45
46protected:
47 SettingBase(const QString &key, Settings *settings, QObject *parent = nullptr);
48
49 /** @brief <tt>QSettings</tt> key for the value. */
50 const QString m_key;
51
52 /** @brief Corresponding @ref Settings object. */
53 QPointer<Settings> m_settings;
54
55 QSettings *underlyingQSettings();
56
57private:
58 /** @internal @brief Only for unit tests. */
59 friend class TestSettingBase;
60};
61
62} // namespace PerceptualColor
63
64#endif // SETTINGBASE_H
The namespace of this library.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:57:18 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.