15 #ifndef QGSCOLORBUTTON_H 16 #define QGSCOLORBUTTON_H 18 #include <QColorDialog> 19 #include <QToolButton> 20 #include <QTemporaryFile> 41 if ( qobject_cast<QgsColorButton *>( sipCpp ) )
42 sipType = sipType_QgsColorButton;
50 Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )
51 Q_PROPERTY( QColor color READ color WRITE setColor )
52 Q_PROPERTY(
bool allowOpacity READ allowOpacity WRITE setAllowOpacity )
53 Q_PROPERTY(
bool showMenu READ showMenu WRITE setShowMenu )
54 Q_PROPERTY(
Behavior behavior READ behavior WRITE setBehavior )
55 Q_PROPERTY( QColor defaultColor READ defaultColor WRITE setDefaultColor )
56 Q_PROPERTY(
bool showNoColor READ showNoColor WRITE setShowNoColor )
57 Q_PROPERTY( QString noColorString READ noColorString WRITE setNoColorString )
58 Q_PROPERTY( QString context READ context WRITE setContext )
81 QSize minimumSizeHint()
const override;
82 QSize sizeHint()
const override;
98 void setAllowOpacity(
bool allowOpacity );
114 void setColorDialogTitle(
const QString &title );
121 QString colorDialogTitle()
const;
129 void setShowMenu(
bool showMenu );
136 bool showMenu()
const {
return menu() ? true :
false; }
144 void setBehavior(
Behavior behavior );
160 void setDefaultColor(
const QColor &color );
180 void setShowNoColor(
const bool showNoColorOption ) { mShowNoColorOption = showNoColorOption; }
210 void setShowNull(
bool showNull );
218 bool showNull()
const;
245 void setContext(
const QString &context ) { mContext = context; }
282 void setColor(
const QColor &color );
292 void setButtonBackground(
const QColor &color = QColor() );
310 void activatePicker();
326 void setToDefaultColor();
343 void colorChanged(
const QColor &color );
351 void colorClicked(
const QColor &color );
355 bool event( QEvent *e )
override;
356 void changeEvent( QEvent *e )
override;
357 void showEvent( QShowEvent *e )
override;
358 void resizeEvent( QResizeEvent *event )
override;
363 static const QPixmap &transparentBackground();
368 void mousePressEvent( QMouseEvent *e )
override;
373 void mouseMoveEvent( QMouseEvent *e )
override;
378 void mouseReleaseEvent( QMouseEvent *e )
override;
383 void keyPressEvent( QKeyEvent *e )
override;
388 void dragEnterEvent( QDragEnterEvent *e )
override;
393 void dragLeaveEvent( QDragLeaveEvent *e )
override;
398 void dropEvent( QDropEvent *e )
override;
403 QColor sampleColor( QPoint point )
const;
405 static QScreen *findScreenAt( QPoint pos );
407 QString mColorDialogTitle;
413 QColor mDefaultColor;
416 QColor mCurrentColor;
419 bool mAllowOpacity =
false;
420 bool mColorSet =
false;
422 bool mShowNoColorOption =
false;
423 QString mNoColorString;
424 bool mShowNull =
false;
426 QPoint mDragStartPosition;
427 bool mPickingColor =
false;
429 QMenu *mMenu =
nullptr;
441 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
449 void stopPicking( QPoint eventPos,
bool samplingColor =
true );
457 QPixmap createMenuIcon(
const QColor &color,
bool showChecks =
true );
461 void buttonClicked();
463 void showColorDialog();
468 void setValidColor(
const QColor &newColor );
474 void setValidTemporaryColor(
const QColor &newColor );
480 void addRecentColor(
const QColor &color );
Registry of color schemes.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)