digiKam
Loading...
Searching...
No Matches
dhuesaturationselect.h
Go to the documentation of this file.
1/* ============================================================
2 *
3 * This file is a part of digiKam project
4 * https://www.digikam.org
5 *
6 * Date : 1997-02-20
7 * Description : color chooser widgets
8 *
9 * SPDX-FileCopyrightText: 1997 by Martin Jones <mjones at kde dot org>
10 * SPDX-FileCopyrightText: 2015-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
11 *
12 * SPDX-License-Identifier: GPL-2.0-or-later
13 *
14 * ============================================================ */
15
16#pragma once
17
18// Qt includes
19
20#include <QWidget>
21#include <QPixmap>
22
23// Local includes
24
25#include "digikam_export.h"
26#include "dcolorchoosermode.h"
27
28namespace Digikam
29{
30
31class DIGIKAM_EXPORT DPointSelect : public QWidget
32{
33 Q_OBJECT
34 Q_PROPERTY(int xValue READ xValue WRITE setXValue)
35 Q_PROPERTY(int yValue READ yValue WRITE setYValue)
36
37public:
38
43 explicit DPointSelect(QWidget* const parent);
44 ~DPointSelect() override;
45
52 void setValues(int xPos, int yPos);
53
58 void setXValue(int xPos);
59
64 void setYValue(int yPos);
65
69 void setRange(int minX, int minY, int maxX, int maxY);
70
75 void setMarkerColor(const QColor& col);
76
80 int xValue() const;
81
85 int yValue() const;
86
90 QRect contentsRect() const;
91
95 QSize minimumSizeHint() const override;
96
97Q_SIGNALS:
98
103 void valueChanged(int x, int y);
104
105protected:
106
113 virtual void drawContents(QPainter*)
114 {
115 };
116
121 virtual void drawMarker(QPainter* p, int xp, int yp);
122
123 void paintEvent(QPaintEvent* e) override;
124 void mousePressEvent(QMouseEvent* e) override;
125 void mouseMoveEvent(QMouseEvent* e) override;
126 void wheelEvent(QWheelEvent*) override;
127
131 void valuesFromPosition(int x, int y, int& xVal, int& yVal) const;
132
133private:
134
135 void setPosition(int xp, int yp);
136
137private:
138
139 DPointSelect(); // Disable default constructor.
140 Q_DISABLE_COPY(DPointSelect)
141
142 class Private;
143 friend class Private;
144 Private* const d = nullptr;
145};
146
147// --------------------------------------------------------------------------------
148
149class DIGIKAM_EXPORT DHueSaturationSelector : public DPointSelect
150{
151 Q_OBJECT
152
153public:
154
158 explicit DHueSaturationSelector(QWidget* const parent = nullptr);
159
163 ~DHueSaturationSelector() override;
164
171 void setChooserMode(DColorChooserMode chooserMode);
172
178 DColorChooserMode chooserMode() const;
179
180
186 int hue() const;
187
193 void setHue(int hue);
194
200 int saturation() const;
201
207 void setSaturation(int saturation);
208
214 int colorValue() const;
215
221 void setColorValue(int color);
222
226 void updateContents();
227
228protected:
229
234 virtual void drawPalette(QPixmap* pixmap);
235 void resizeEvent(QResizeEvent*) override;
236
242 void drawContents(QPainter* painter) override;
243
244private:
245
246 Q_DISABLE_COPY(DHueSaturationSelector)
247
248 class Private;
249 friend class Private;
250 Private* const d = nullptr;
251};
252
253} // namespace Digikam
Definition dhuesaturationselect.h:150
Definition dhuesaturationselect.h:32
Definition datefolderview.cpp:34
DColorChooserMode
Definition dcolorchoosermode.h:22