color_dialog.hpp
Go to the documentation of this file.
00001 
00022 #ifndef COLOR_DIALOG_HPP
00023 #define COLOR_DIALOG_HPP
00024 
00025 #include "colorwidgets_global.hpp"
00026 #include "color_preview.hpp"
00027 #include "color_wheel.hpp"
00028 
00029 #include <QDialog>
00030 
00031 class QAbstractButton;
00032 
00033 namespace color_widgets {
00034 
00035 class  ColorDialog : public QDialog
00036 {
00037     Q_OBJECT
00038     Q_ENUMS(ButtonMode)
00039     Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged DESIGNABLE true)
00040     Q_PROPERTY(ColorWheel::DisplayFlags wheelFlags READ wheelFlags WRITE setWheelFlags NOTIFY wheelFlagsChanged)
00041 
00042 
00043 public:
00044     enum ButtonMode {
00045         OkCancel,
00046         OkApplyCancel,
00047         Close
00048     };
00049 
00050     explicit ColorDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
00051 
00055     QColor color() const;
00056 
00060     void setPreviewDisplayMode(ColorPreview::DisplayMode mode);
00061 
00065     ColorPreview::DisplayMode previewDisplayMode() const;
00066 
00067     bool alphaEnabled() const;
00068 
00077     void setButtonMode(ButtonMode mode);
00078     ButtonMode buttonMode() const;
00079 
00080     QSize sizeHint() const;
00081 
00082     ColorWheel::DisplayFlags wheelFlags() const;
00083 
00084 public slots:
00085 
00089     void setColor(const QColor &c);
00090 
00094     void showColor(const QColor &oldcolor);
00095 
00096     void setWheelFlags(ColorWheel::DisplayFlags flags);
00097 
00098 
00099 signals:
00103     void colorChanged(QColor);
00104 
00108     void colorSelected(QColor);
00109 
00110     void wheelFlagsChanged(ColorWheel::DisplayFlags flags);
00111     void alphaEnabledChanged(bool alphaEnabled);
00112 
00113 private slots:
00115     void update_widgets();
00117     void set_hsv();
00119     void set_rgb();
00120 
00121     void on_buttonBox_clicked(QAbstractButton*);
00122 
00123 private:
00124     void setColorInternal(const QColor &color);
00125 
00126 protected:
00127     void dragEnterEvent(QDragEnterEvent *event);
00128     void dropEvent(QDropEvent * event);
00129     void mouseReleaseEvent(QMouseEvent *event);
00130     void mouseMoveEvent(QMouseEvent *event);
00131 
00132 private:
00133     class Private;
00134     Private * const p;
00135 };
00136 
00137 } // namespace color_widgets
00138 
00139 #endif // COLOR_DIALOG_HPP


plotjuggler
Author(s): Davide Faconti
autogenerated on Fri Sep 1 2017 02:41:55