15 #ifndef QGSCOLORBUTTON_H 16 #define QGSCOLORBUTTON_H 18 #include <QColorDialog> 19 #include <QToolButton> 40 if ( qobject_cast<QgsColorButton *>( sipCpp ) )
41 sipType = sipType_QgsColorButton;
49 Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )
50 Q_PROPERTY( QColor color READ color WRITE setColor )
51 Q_PROPERTY(
bool allowOpacity READ allowOpacity WRITE setAllowOpacity )
52 Q_PROPERTY(
bool showMenu READ showMenu WRITE setShowMenu )
53 Q_PROPERTY(
Behavior behavior READ behavior WRITE setBehavior )
54 Q_PROPERTY( QColor defaultColor READ defaultColor WRITE setDefaultColor )
55 Q_PROPERTY(
bool showNoColor READ showNoColor WRITE setShowNoColor )
56 Q_PROPERTY( QString noColorString READ noColorString WRITE setNoColorString )
57 Q_PROPERTY( QString context READ context WRITE setContext )
80 QSize minimumSizeHint()
const override;
81 QSize sizeHint()
const override;
97 void setAllowOpacity(
bool allowOpacity );
113 void setColorDialogTitle(
const QString &title );
120 QString colorDialogTitle()
const;
128 void setShowMenu(
bool showMenu );
135 bool showMenu()
const {
return menu() ? true :
false; }
143 void setBehavior(
Behavior behavior );
159 void setDefaultColor(
const QColor &color );
179 void setShowNoColor(
const bool showNoColorOption ) { mShowNoColorOption = showNoColorOption; }
209 void setShowNull(
bool showNull );
217 bool showNull()
const;
244 void setContext(
const QString &context ) { mContext = context; }
287 void linkToProjectColor(
const QString &name );
305 static QPixmap createMenuIcon(
const QColor &color,
bool showChecks =
true );
315 void setColor(
const QColor &color );
325 void setButtonBackground(
const QColor &color = QColor() );
343 void activatePicker();
359 void setToDefaultColor();
386 void colorChanged(
const QColor &color );
394 void colorClicked(
const QColor &color );
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;
457 QString mColorDialogTitle;
463 QColor mDefaultColor;
466 QColor mCurrentColor;
469 bool mAllowOpacity =
false;
470 bool mColorSet =
false;
472 bool mShowNoColorOption =
false;
473 QString mNoColorString;
474 bool mShowNull =
false;
476 QPoint mDragStartPosition;
477 bool mPickingColor =
false;
479 QMenu *mMenu =
nullptr;
482 QString mLinkedColorName;
483 bool mShowMenu =
true;
493 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
501 void stopPicking( QPoint eventPos,
bool samplingColor =
true );
503 QColor linkedProjectColor()
const;
507 void buttonClicked();
509 void showColorDialog();
514 void setValidColor(
const QColor &newColor );
520 void setValidTemporaryColor(
const QColor &newColor );
526 void addRecentColor(
const QColor &color );
Registry of color schemes.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)