15 #ifndef QGSCOLORBUTTON_H
16 #define QGSCOLORBUTTON_H
18 #include <QColorDialog>
19 #include <QPushButton>
20 #include <QTemporaryFile>
34 Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )
35 Q_PROPERTY(
bool acceptLiveUpdates READ acceptLiveUpdates WRITE setAcceptLiveUpdates )
36 Q_PROPERTY( QColor color READ color WRITE setColor )
37 Q_FLAGS( QColorDialog::ColorDialogOptions )
38 Q_PROPERTY( QColorDialog::ColorDialogOptions colorDialogOptions READ colorDialogOptions WRITE setColorDialogOptions )
49 QgsColorButton( QWidget *parent = 0, QString cdt = "", QColorDialog::ColorDialogOptions cdo = 0 );
57 void setColor( const QColor &color );
70 void setColorDialogOptions( QColorDialog::ColorDialogOptions cdo );
77 QColorDialog::ColorDialogOptions colorDialogOptions();
84 void setColorDialogTitle( QString cdt );
91 QString colorDialogTitle();
96 bool acceptLiveUpdates() {
return mAcceptLiveUpdates; }
112 void setButtonBackground( QColor color = QColor() );
121 void colorChanged(
const QColor &color );
124 void changeEvent( QEvent* e );
125 void showEvent( QShowEvent* e );
126 static const QPixmap& transpBkgrd();
131 void mousePressEvent( QMouseEvent* e );
136 void mouseMoveEvent( QMouseEvent *e );
141 void mouseReleaseEvent( QMouseEvent *e );
146 void keyPressEvent( QKeyEvent *e );
151 void dragEnterEvent( QDragEnterEvent * e );
156 void dropEvent( QDropEvent *e );
159 QString mColorDialogTitle;
161 QColorDialog::ColorDialogOptions mColorDialogOptions;
162 bool mAcceptLiveUpdates;
163 QTemporaryFile mTempPNG;
166 QPoint mDragStartPosition;
172 void showContextMenu( QMouseEvent* event );
180 QMimeData* createColorMimeData()
const;
191 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
200 QString fullPath(
const QString &path );
210 void stopPicking( QPointF eventPos,
bool sampleColor =
true );
213 void onButtonClicked();
218 void setValidColor(
const QColor& newColor );