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 QColor sampleColor( QPoint point )
const;
459 static QScreen *findScreenAt( QPoint pos );
461 QString mColorDialogTitle;
467 QColor mDefaultColor;
470 QColor mCurrentColor;
473 bool mAllowOpacity =
false;
474 bool mColorSet =
false;
476 bool mShowNoColorOption =
false;
477 QString mNoColorString;
478 bool mShowNull =
false;
480 QPoint mDragStartPosition;
481 bool mPickingColor =
false;
483 QMenu *mMenu =
nullptr;
486 QString mLinkedColorName;
487 bool mShowMenu =
true;
497 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
505 void stopPicking( QPoint eventPos,
bool samplingColor =
true );
507 QColor linkedProjectColor()
const;
511 void buttonClicked();
513 void showColorDialog();
518 void setValidColor(
const QColor &newColor );
524 void setValidTemporaryColor(
const QColor &newColor );
530 void addRecentColor(
const QColor &color );
Registry of color schemes.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)