Perceptual Color

multispinboxsection.h
1// SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
2// SPDX-License-Identifier: BSD-2-Clause OR MIT
3
4#ifndef MULTISPINBOXSECTION_H
5#define MULTISPINBOXSECTION_H
6
7#include "constpropagatinguniquepointer.h"
8#include "importexport.h"
9#include <qdebug.h>
10#include <qmetatype.h>
11#include <qstring.h>
12
13namespace PerceptualColor
14{
15class MultiSpinBoxSectionPrivate;
16
17/** @brief The configuration of a single section
18 * within a @ref MultiSpinBox.
19 *
20 * For a specific section within a @ref MultiSpinBox, this configuration
21 * contains various settings.
22 *
23 * This data type can be passed to QDebug thanks to
24 * @ref operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
25 *
26 * This type is declared as type to Qt’s type system via
27 * <tt>Q_DECLARE_METATYPE</tt>. Depending on your use case (for
28 * example if you want to use for <em>queued</em> signal-slot connections),
29 * you might consider calling <tt>qRegisterMetaType()</tt> for
30 * this type, once you have a QApplication object.
31 *
32 * @internal
33 *
34 * Also Qt itself uses this configuration-object-based approach with its
35 * QNetworkConfiguration class (including @ref pimpl and
36 * copy-constructors). */
38{
39public:
42 ~MultiSpinBoxSection() noexcept;
46
47 [[nodiscard]] int decimals() const;
48 [[nodiscard]] bool isWrapping() const;
49 [[nodiscard]] double maximum() const;
50 [[nodiscard]] double minimum() const;
51 [[nodiscard]] QString prefix() const;
52 void setDecimals(int newDecimals);
53 void setMaximum(double newMaximum);
54 void setMinimum(double newMinimum);
55 void setPrefix(const QString &newPrefix);
56 void setSingleStep(double newSingleStep);
57 void setSuffix(const QString &newSuffix);
58 void setWrapping(bool newIsWrapping);
59 [[nodiscard]] double singleStep() const;
60 [[nodiscard]] QString suffix() const;
61
62private:
63 /** @internal
64 *
65 * @brief Declare the private implementation as friend class.
66 *
67 * This allows the private class to access the protected members and
68 * functions of instances of <em>this</em> class. */
69 friend class MultiSpinBoxSectionPrivate;
70 /** @brief Pointer to implementation (pimpl) */
71 ConstPropagatingUniquePointer<MultiSpinBoxSectionPrivate> d_pointer;
72
73 /** @internal @brief Only for unit tests. */
74 friend class TestMultiSpinBoxSection;
75
76 /** @internal
77 * @brief Internal friend declaration.
78 *
79 * This class is used as configuration for @ref MultiSpinBox. Thought
80 * currently there is no need for this <tt>friend</tt> declaration,
81 * it is done nevertheless. (If it would become necessary later,
82 * adding it would break the binary API, which we want to avoid.) */
83 friend class MultiSpinBox;
84};
85
87
88} // namespace PerceptualColor
89
91
92#endif // MULTISPINBOXSECTION_H
The configuration of a single section within a MultiSpinBox.
MultiSpinBoxSection & operator=(const MultiSpinBoxSection &other)
Copy assignment operator.
QString prefix() const
A prefix to be displayed before the value.
int decimals() const
The number of digits after the decimal point.
double singleStep() const
A smaller of two natural steps.
double maximum() const
The maximum possible value of the section.
void setDecimals(int newDecimals)
Setter for decimals property.
double minimum() const
The minimum possible value of the section.
void setMaximum(double newMaximum)
Setter for maximum property.
void setMinimum(double newMinimum)
Setter for minimum property.
void setSuffix(const QString &newSuffix)
Setter for suffix property.
QString suffix() const
The suffix to be displayed behind the value.
void setWrapping(bool newIsWrapping)
Setter for isWrapping property.
bool isWrapping() const
Holds whether or not MultiSpinBox::sectionValues wrap around when they reaches minimum or maximum.
void setSingleStep(double newSingleStep)
Setter for singleStep property.
void setPrefix(const QString &newPrefix)
Setter for prefix property.
This file provides support for C++ symbol import and export.
#define PERCEPTUALCOLOR_IMPORTEXPORT
A macro that either exports dynamic library symbols or imports dynamic library symbols or does nothin...
The namespace of this library.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:46:43 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.