39 if ( qobject_cast<QgsColorButton *>( sipCpp ) )
40 sipType = sipType_QgsColorButton;
48 Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )
49 Q_PROPERTY( QColor color READ color WRITE setColor )
50 Q_PROPERTY(
bool allowOpacity READ allowOpacity WRITE setAllowOpacity )
51 Q_PROPERTY(
bool showMenu READ showMenu WRITE setShowMenu )
52 Q_PROPERTY(
Behavior behavior READ behavior WRITE setBehavior )
53 Q_PROPERTY( QColor defaultColor READ defaultColor WRITE setDefaultColor )
54 Q_PROPERTY(
bool showNoColor READ showNoColor WRITE setShowNoColor )
55 Q_PROPERTY( QString noColorString READ noColorString WRITE setNoColorString )
56 Q_PROPERTY( QString context READ context WRITE setContext )
79 QSize minimumSizeHint()
const override;
80 QSize sizeHint()
const override;
95 void setAllowOpacity(
bool allowOpacity );
110 void setColorDialogTitle(
const QString &title );
117 QString colorDialogTitle()
const;
125 void setShowMenu(
bool showMenu );
132 bool showMenu()
const {
return menu() ? true :
false; }
140 void setBehavior( Behavior behavior );
156 void setDefaultColor(
const QColor &color );
176 void setShowNoColor(
const bool showNoColorOption ) { mShowNoColorOption = showNoColorOption; }
206 void setShowNull(
bool showNull,
const QString &nullString = QString() );
213 bool showNull()
const;
239 void setContext(
const QString &context ) { mContext = context; }
282 void linkToProjectColor(
const QString &name );
300 static QPixmap createMenuIcon(
const QColor &color,
bool showChecks =
true );
310 void setColor(
const QColor &color );
320 void setButtonBackground(
const QColor &color = QColor() );
338 void activatePicker();
354 void setToDefaultColor();
412 bool event( QEvent *e )
override;
413 void changeEvent( QEvent *e )
override;
414 void showEvent( QShowEvent *e )
override;
415 void resizeEvent( QResizeEvent *event )
override;
420 static const QPixmap &transparentBackground();
425 void mousePressEvent( QMouseEvent *e )
override;
430 void mouseMoveEvent( QMouseEvent *e )
override;
435 void mouseReleaseEvent( QMouseEvent *e )
override;
440 void keyPressEvent( QKeyEvent *e )
override;
445 void dragEnterEvent( QDragEnterEvent *e )
override;
450 void dragLeaveEvent( QDragLeaveEvent *e )
override;
455 void dropEvent( QDropEvent *e )
override;
457 void wheelEvent( QWheelEvent *event )
override;
462 QString mColorDialogTitle;
468 QColor mDefaultColor;
471 QColor mCurrentColor;
474 bool mAllowOpacity =
false;
475 bool mColorSet =
false;
477 bool mShowNoColorOption =
false;
478 QString mNoColorString;
479 bool mShowNull =
false;
480 QString mNullColorString;
482 QPoint mDragStartPosition;
483 bool mPickingColor =
false;
485 QMenu *mMenu =
nullptr;
488 QString mLinkedColorName;
489 bool mShowMenu =
true;
499 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
507 void stopPicking( QPoint eventPos,
bool samplingColor =
true );
509 QColor linkedProjectColor()
const;
513 void buttonClicked();
515 void showColorDialog();
520 void setValidColor(
const QColor &newColor );
526 void setValidTemporaryColor(
const QColor &newColor );
532 void addRecentColor(
const QColor &color );