Qt Utilities: paletteeditor/colorbutton.h Source File

Qt Utilities 6.21.3 Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models

Loading...
Searching...
No Matches
colorbutton.h
Go to the documentation of this file.
1#ifndef WIDGETS_COLORBUTTON_H
2#define WIDGETS_COLORBUTTON_H
3
4#include "../global.h"
5
6#include <QToolButton>
7
8namespace QtUtilities {
9
15 class QT_UTILITIES_EXPORT ColorButton : public QToolButton {
16 Q_OBJECT
17 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged)
18 Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered)
19public:
20 ColorButton(QWidget *parent = nullptr);
21 ~ColorButton() override;
22
23 bool isBackgroundCheckered() const;
24 void setBackgroundCheckered(bool checkered);
25
26 QColor color() const;
27
28public Q_SLOTS:
29 void setColor(const QColor &color);
30
31Q_SIGNALS:
32 void colorChanged(const QColor &color);
33
34protected:
35 void paintEvent(QPaintEvent *event) override;
36 void mousePressEvent(QMouseEvent *event) override;
37 void mouseMoveEvent(QMouseEvent *event) override;
38#ifndef QT_NO_DRAGANDDROP
39 void dragEnterEvent(QDragEnterEvent *event) override;
40 void dragLeaveEvent(QDragLeaveEvent *event) override;
41 void dropEvent(QDropEvent *event) override;
42#endif
43
44private:
45 QScopedPointer<class ColorButtonPrivate> d_ptr;
46 Q_DECLARE_PRIVATE(ColorButton)
47 Q_DISABLE_COPY(ColorButton)
48 Q_PRIVATE_SLOT(d_func(), void slotEditColor())
49};
50} // namespace QtUtilities
51
52#endif // WIDGETS_COLORBUTTON_H
QtUtilities::ColorButton::isBackgroundCheckered
bool isBackgroundCheckered() const
Definition colorbutton.cpp:121
QtUtilities::ColorButton::dragLeaveEvent
void dragLeaveEvent(QDragLeaveEvent *event) override
Definition colorbutton.cpp:199
QtUtilities::ColorButton::backgroundCheckered
bool backgroundCheckered
Definition colorbutton.h:18
QtUtilities::ColorButton::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event) override
Definition colorbutton.cpp:168
QtUtilities::ColorButton::paintEvent
void paintEvent(QPaintEvent *event) override
Definition colorbutton.cpp:126
QtUtilities::ColorButton::setBackgroundCheckered
void setBackgroundCheckered(bool checkered)
Definition colorbutton.cpp:113
QtUtilities::ColorButton::mousePressEvent
void mousePressEvent(QMouseEvent *event) override
Definition colorbutton.cpp:159
QtUtilities::ColorButton::color
QColor color
Definition colorbutton.h:17
QtUtilities::ColorButton::dragEnterEvent
void dragEnterEvent(QDragEnterEvent *event) override
Definition colorbutton.cpp:187
QtUtilities::ColorButton::ColorButton
ColorButton(QWidget *parent=nullptr)
Definition colorbutton.cpp:82
QtUtilities::ColorButton::dropEvent
void dropEvent(QDropEvent *event) override
Definition colorbutton.cpp:206
QtUtilities::ColorButton::setColor
void setColor(const QColor &color)
Definition colorbutton.cpp:100
QtUtilities::ColorButton::colorChanged
void colorChanged(const QColor &color)
global.h
QT_UTILITIES_EXPORT
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Definition global.h:14
QtUtilities
!
Definition trylocker.h:8