Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qtcolorline_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header file may change from version to version
11// without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef QTCOLORLINE_H
17#define QTCOLORLINE_H
18
19#include <QtWidgets/qwidget.h>
20
21QT_BEGIN_NAMESPACE
22
23class QtColorLine : public QWidget
24{
25 Q_OBJECT
26 Q_PROPERTY(QColor color READ color WRITE setColor)
27 Q_PROPERTY(int indicatorSpace READ indicatorSpace WRITE setIndicatorSpace)
28 Q_PROPERTY(int indicatorSize READ indicatorSize WRITE setIndicatorSize)
29 Q_PROPERTY(bool flip READ flip WRITE setFlip)
30 Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered)
31 Q_PROPERTY(ColorComponent colorComponent READ colorComponent WRITE setColorComponent)
32 Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
33public:
34
35 enum ColorComponent {
36 Red,
37 Green,
38 Blue,
39 Hue,
40 Saturation,
41 Value,
42 Alpha
43 };
44 Q_ENUM(ColorComponent)
45
46 QSize minimumSizeHint() const override;
47 QSize sizeHint() const override;
48
49 explicit QtColorLine(QWidget *parent = nullptr);
50 ~QtColorLine() override;
51
52 QColor color() const;
53
54 void setIndicatorSize(int size);
55 int indicatorSize() const;
56
57 void setIndicatorSpace(int space);
58 int indicatorSpace() const;
59
60 void setFlip(bool flip);
61 bool flip() const;
62
63 bool isBackgroundCheckered() const;
64 void setBackgroundCheckered(bool checkered);
65
66 void setOrientation(Qt::Orientation orientation);
67 Qt::Orientation orientation() const;
68
69 void setColorComponent(ColorComponent component);
70 ColorComponent colorComponent() const;
71
72public slots:
73 void setColor(QColor color);
74
75signals:
76 void colorChanged(QColor color);
77
78protected:
79 void resizeEvent(QResizeEvent *event) override;
80 void paintEvent(QPaintEvent *event) override;
81 void mousePressEvent(QMouseEvent *event) override;
82 void mouseMoveEvent(QMouseEvent *event) override;
83 void mouseReleaseEvent(QMouseEvent *event) override;
84 void mouseDoubleClickEvent(QMouseEvent *event) override;
85
86private:
87 QScopedPointer<class QtColorLinePrivate> d_ptr;
88 Q_DECLARE_PRIVATE(QtColorLine)
89 Q_DISABLE_COPY_MOVE(QtColorLine)
90};
91
92QT_END_NAMESPACE
93
94#endif
friend class QPainter
\inmodule QtCore\reentrant
Definition qpoint.h:30
void setIndicatorSize(int size)
void mouseDoubleClickEvent(QMouseEvent *event)
Qt::Orientation orientation() const
void mouseReleaseEvent(QMouseEvent *event)
void setOrientation(Qt::Orientation orientation)
void setColor(QColor color)
int indicatorSize() const
void mouseMoveEvent(QMouseEvent *event)
void paintEvent(QPaintEvent *event)
int indicatorSpace() const
void setIndicatorSpace(int space)
void resizeEvent(QResizeEvent *event)
QtColorLine::ColorComponent colorComponent() const
void setColorComponent(QtColorLine::ColorComponent component)
bool isBackgroundCheckered() const
void setFlip(bool flip)
void setBackgroundCheckered(bool checkered)
void mousePressEvent(QMouseEvent *event)
QColor color() const