Qt Utilities  5.6.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
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 
8 namespace Widgets {
9 
15 class QT_UTILITIES_EXPORT ColorButton : public QToolButton
16 {
17  Q_OBJECT
18  Q_PROPERTY(bool backgroundCheckered READ isBackgroundCheckered WRITE setBackgroundCheckered)
19 public:
20  ColorButton(QWidget *parent = nullptr);
21  ~ColorButton();
22 
23  bool isBackgroundCheckered() const;
24  void setBackgroundCheckered(bool checkered);
25 
26  QColor color() const;
27 
28 public Q_SLOTS:
29  void setColor(const QColor &color);
30 
31 Q_SIGNALS:
32  void colorChanged(const QColor &color);
33 
34 protected:
35  void paintEvent(QPaintEvent *event);
36  void mousePressEvent(QMouseEvent *event);
37  void mouseMoveEvent(QMouseEvent *event);
38 #ifndef QT_NO_DRAGANDDROP
39  void dragEnterEvent(QDragEnterEvent *event);
40  void dragLeaveEvent(QDragLeaveEvent *event);
41  void dropEvent(QDropEvent *event);
42 #endif
43 
44 private:
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 
51 }
52 
53 #endif // WIDGETS_COLORBUTTON_H
The ColorButton class is used by PaletteEditor.
Definition: colorbutton.h:15
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
Provides a set of extended widgets such as ClearLineEdit and ClearComboBox.
Definition: buttonoverlay.h:13