tilde~
Puredata Qt-based GUI
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
color_dialog.hpp
Go to the documentation of this file.
1 
23 #ifndef COLOR_DIALOG_HPP
24 #define COLOR_DIALOG_HPP
25 
26 #include "colorpicker_global.hpp"
27 #include "color_preview.hpp"
28 #include "color_wheel.hpp"
29 
30 #include <QDialog>
31 
32 class QAbstractButton;
33 
34 class QCP_EXPORT Color_Dialog : public QDialog
35 {
36  Q_OBJECT
37  Q_ENUMS(Button_Mode)
38  Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true)
39  Q_PROPERTY(Color_Wheel::Display_Flags wheelFlags READ wheelFlags WRITE setWheelFlags NOTIFY wheelFlagsChanged)
40 
41 public:
42  enum Button_Mode {
45  Close
46  };
47 
48  explicit Color_Dialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
49 
53  QColor color() const;
54 
58  void setPreviewDisplayMode(Color_Preview::Display_Mode mode);
59 
63  Color_Preview::Display_Mode previewDisplayMode() const;
64 
69  void setAlphaEnabled(bool a);
70 
71  bool alphaEnabled() const;
72 
81  void setButtonMode(Button_Mode mode);
82  Button_Mode buttonMode() const;
83 
84  QSize sizeHint() const;
85 
86  Color_Wheel::Display_Flags wheelFlags() const;
87 
88 public slots:
89 
93  void setColor(const QColor &c);
94 
98  void showColor(const QColor &oldcolor);
99 
100  void setWheelFlags(Color_Wheel::Display_Flags flags);
101 
102 signals:
106  void colorChanged(QColor);
107 
111  void colorSelected(QColor);
112 
113  void wheelFlagsChanged(Color_Wheel::Display_Flags flags);
114 
115 private slots:
117  void update_widgets();
119  void set_hsv();
121  void set_rgb();
122 
123  void on_edit_hex_editingFinished();
124  void on_edit_hex_textEdited(const QString &arg1);
125 
126  void on_buttonBox_clicked(QAbstractButton*);
127 
128 private:
129  void update_hex();
130  void setColorInternal(const QColor &color);
131 
132 protected:
133  void dragEnterEvent(QDragEnterEvent *event);
134  void dropEvent(QDropEvent * event);
135  void mouseReleaseEvent(QMouseEvent *event);
136  void mouseMoveEvent(QMouseEvent *event);
137 
138 private:
139  class Private;
140  Private * const p;
141 };
142 
143 #endif // COLOR_DIALOG_HPP
Button_Mode
Definition: color_dialog.hpp:42
Definition: color_dialog.hpp:44
#define QCP_EXPORT
Definition: colorpicker_global.hpp:9
Definition: color_dialog.hpp:43
Display an analog widget that allows the selection of a HSV color.
Definition: color_wheel.hpp:36
Display_Mode
Definition: color_preview.hpp:45
Definition: color_dialog.hpp:34