38 if ( qobject_cast<QgsColorButton *>( sipCpp ) )
39 sipType = sipType_QgsColorButton;
47 Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )
48 Q_PROPERTY( QColor color READ color WRITE setColor )
49 Q_PROPERTY(
bool allowOpacity READ allowOpacity WRITE setAllowOpacity )
50 Q_PROPERTY(
bool showMenu READ showMenu WRITE setShowMenu )
51 Q_PROPERTY(
Behavior behavior READ behavior WRITE setBehavior )
52 Q_PROPERTY( QColor defaultColor READ defaultColor WRITE setDefaultColor )
53 Q_PROPERTY(
bool showNoColor READ showNoColor WRITE setShowNoColor )
54 Q_PROPERTY( QString noColorString READ noColorString WRITE setNoColorString )
55 Q_PROPERTY( QString context READ context WRITE setContext )
77 QSize minimumSizeHint()
const override;
78 QSize sizeHint()
const override;
93 void setAllowOpacity(
bool allowOpacity );
108 void setColorDialogTitle(
const QString &title );
115 QString colorDialogTitle()
const;
123 void setShowMenu(
bool showMenu );
130 bool showMenu()
const {
return menu() ? true :
false; }
138 void setBehavior( Behavior behavior );
154 void setDefaultColor(
const QColor &color );
174 void setShowNoColor(
const bool showNoColorOption ) { mShowNoColorOption = showNoColorOption; }
204 void setShowNull(
bool showNull,
const QString &nullString = QString() );
211 bool showNull()
const;
237 void setContext(
const QString &context ) { mContext = context; }
280 void linkToProjectColor(
const QString &name );
298 static QPixmap createMenuIcon(
const QColor &color,
bool showChecks =
true );
308 void setColor(
const QColor &color );
318 void setButtonBackground(
const QColor &color = QColor() );
336 void activatePicker();
352 void setToDefaultColor();
409 bool event( QEvent *e )
override;
410 void changeEvent( QEvent *e )
override;
411 void showEvent( QShowEvent *e )
override;
412 void resizeEvent( QResizeEvent *event )
override;
417 static const QPixmap &transparentBackground();
422 void mousePressEvent( QMouseEvent *e )
override;
427 void mouseMoveEvent( QMouseEvent *e )
override;
432 void mouseReleaseEvent( QMouseEvent *e )
override;
437 void keyPressEvent( QKeyEvent *e )
override;
442 void dragEnterEvent( QDragEnterEvent *e )
override;
447 void dragLeaveEvent( QDragLeaveEvent *e )
override;
452 void dropEvent( QDropEvent *e )
override;
454 void wheelEvent( QWheelEvent *event )
override;
458 QString mColorDialogTitle;
464 QColor mDefaultColor;
467 QColor mCurrentColor;
470 bool mAllowOpacity =
false;
471 bool mColorSet =
false;
473 bool mShowNoColorOption =
false;
474 QString mNoColorString;
475 bool mShowNull =
false;
476 QString mNullColorString;
478 QPoint mDragStartPosition;
479 bool mPickingColor =
false;
481 QMenu *mMenu =
nullptr;
484 QString mLinkedColorName;
485 bool mShowMenu =
true;
495 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
503 void stopPicking( QPoint eventPos,
bool samplingColor =
true );
505 QColor linkedProjectColor()
const;
509 void buttonClicked();
511 void showColorDialog();
516 void setValidColor(
const QColor &newColor );
522 void setValidTemporaryColor(
const QColor &newColor );
528 void addRecentColor(
const QColor &color );