Perceptual Color

gradientslider_p.h
1// SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
2// SPDX-License-Identifier: BSD-2-Clause OR MIT
3
4#ifndef GRADIENTSLIDER_P_H
5#define GRADIENTSLIDER_P_H
6
7// Include the header of the public class of this private implementation.
8// #include "gradientslider.h"
9
10#include "asyncimageprovider.h"
11#include "constpropagatingrawpointer.h"
12#include "gradientimageparameters.h"
13#include "lchadouble.h"
14#include <qglobal.h>
15#include <qnamespace.h>
16#include <qsharedpointer.h>
17class QPoint;
18
19namespace PerceptualColor
20{
21class GradientSlider;
22class RgbColorSpace;
23/** @internal
24 *
25 * @brief Private implementation within the <em>Pointer to
26 * implementation</em> idiom */
27class GradientSliderPrivate final
28{
29public:
30 explicit GradientSliderPrivate(GradientSlider *backLink);
31 /** @brief Default destructor
32 *
33 * The destructor is non-<tt>virtual</tt> because
34 * the class as a whole is <tt>final</tt>. */
35 ~GradientSliderPrivate() noexcept = default;
36
37 // Methods
38 [[nodiscard]] qreal fromWidgetPixelPositionToValue(QPoint pixelPosition);
39 void initialize(const QSharedPointer<RgbColorSpace> &colorSpace, Qt::Orientation orientation);
40 void setOrientationWithoutSignalAndForceNewSizePolicy(Qt::Orientation newOrientation);
41 [[nodiscard]] int physicalPixelLength() const;
42 [[nodiscard]] int physicalPixelThickness() const;
43
44 // Data members
45 /** @brief Internal storage for property @ref GradientSlider::firstColor */
46 LchaDouble m_firstColor;
47 /** @brief The gradient image (without the handle).
48 *
49 * Always at the left is the first color, always at the right
50 * is the second color. This is independent from the actual
51 * @ref GradientSlider::orientation and the actual LTR or RTL
52 * layout. So when painting, it might be necessary to rotate
53 * and/or mirror the image. */
54 AsyncImageProvider<GradientImageParameters> m_gradientImage;
55 /** @brief Properties for @ref m_gradientImage. */
56 GradientImageParameters m_gradientImageParameters;
57 /** @brief Internal storage for property
58 * @ref GradientSlider::orientation */
59 Qt::Orientation m_orientation;
60 /** @brief Internal storage for property
61 * @ref GradientSlider::pageStep */
62 qreal m_pageStep = 0.1;
63 /** @brief Internal storage for property
64 * @ref GradientSlider::secondColor */
65 LchaDouble m_secondColor;
66 /** @brief Internal storage for property
67 * @ref GradientSlider::singleStep */
68 qreal m_singleStep = 0.01;
69 /** @brief Internal storage for property
70 * @ref GradientSlider::value */
71 qreal m_value = 0.5;
72
73private:
74 Q_DISABLE_COPY(GradientSliderPrivate)
75 /** @brief Pointer to the object from which <em>this</em> object
76 * is the private implementation. */
77 ConstPropagatingRawPointer<GradientSlider> q_pointer;
78};
79
80} // namespace PerceptualColor
81
82#endif // GRADIENTSLIDER_P_H
The namespace of this library.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 24 2024 11:48:43 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.