Perceptual Color

colorpatch_p.h
1// SPDX-FileCopyrightText: Lukas Sommer <sommerluk@gmail.com>
2// SPDX-License-Identifier: BSD-2-Clause OR MIT
3
4#ifndef COLORPATCH_P_H
5#define COLORPATCH_P_H
6
7// Include the header of the public class of this private implementation.
8// #include "colorpatch.h"
9
10#include "constpropagatingrawpointer.h"
11#include <qcolor.h>
12#include <qglobal.h>
13#include <qimage.h>
14#include <qpixmap.h>
15#include <qpoint.h>
16class QLabel;
17
18namespace PerceptualColor
19{
20
21class ColorPatch;
22
23/** @internal
24 *
25 * @brief Private implementation within the <em>Pointer to
26 * implementation</em> idiom */
27class ColorPatchPrivate final
28{
29public:
30 /** @brief Constructor */
31 explicit ColorPatchPrivate(ColorPatch *backLink);
32 /** @brief Default destructor
33 *
34 * The destructor is non-<tt>virtual</tt> because
35 * the class as a whole is <tt>final</tt>. */
36 ~ColorPatchPrivate() noexcept = default;
37
38 /** @brief Initial cursor position (at the time of the left-click)
39 * where a drag-and-drop action starts.
40 *
41 * @sa @ref ColorPatch::mousePressEvent
42 * @sa @ref ColorPatch::mouseMoveEvent */
43 QPoint dragStartPosition;
44
45 /** @brief Internal storage for property @ref ColorPatch::color
46 *
47 * QColor automatically initializes with an invalid color, just like it
48 * should be for the property @ref ColorPatch::color, so no need to
49 * initialize here explicitly. */
50 QColor m_color;
51 /** @brief The QLabel widget that is used to display the color. */
52 QLabel *m_label;
53
54 [[nodiscard]] QImage renderImage(const int width, const int height);
55 [[nodiscard]] QPixmap renderPixmap(const int width, const int height);
56 void updatePixmap();
57
58private:
59 Q_DISABLE_COPY(ColorPatchPrivate)
60
61 /** @brief Pointer to the object from which <em>this</em> object
62 * is the private implementation. */
63 ConstPropagatingRawPointer<ColorPatch> q_pointer;
64};
65
66} // namespace PerceptualColor
67
68#endif // COLORPATCH_P_H
The namespace of this library.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:18:38 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.