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; }
288 void linkToProjectColor(
const QString &name );
306 static QPixmap createMenuIcon(
const QColor &color,
bool showChecks =
true );
316 void setColor(
const QColor &color );
326 void setButtonBackground(
const QColor &color = QColor() );
344 void activatePicker();
360 void setToDefaultColor();
387 void colorChanged(
const QColor &color );
395 void colorClicked(
const QColor &color );
410 bool event( QEvent *e )
override;
411 void changeEvent( QEvent *e )
override;
412 void showEvent( QShowEvent *e )
override;
413 void resizeEvent( QResizeEvent *event )
override;
418 static const QPixmap &transparentBackground();
423 void mousePressEvent( QMouseEvent *e )
override;
428 void mouseMoveEvent( QMouseEvent *e )
override;
433 void mouseReleaseEvent( QMouseEvent *e )
override;
438 void keyPressEvent( QKeyEvent *e )
override;
443 void dragEnterEvent( QDragEnterEvent *e )
override;
448 void dragLeaveEvent( QDragLeaveEvent *e )
override;
453 void dropEvent( QDropEvent *e )
override;
458 QColor sampleColor( QPoint point )
const;
460 static QScreen *findScreenAt( QPoint pos );
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;
481 QPoint mDragStartPosition;
482 bool mPickingColor =
false;
484 QMenu *mMenu =
nullptr;
487 QString mLinkedColorName;
488 bool mShowMenu =
true;
498 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
506 void stopPicking( QPoint eventPos,
bool samplingColor =
true );
508 QColor linkedProjectColor()
const;
512 void buttonClicked();
514 void showColorDialog();
519 void setValidColor(
const QColor &newColor );
525 void setValidTemporaryColor(
const QColor &newColor );
531 void addRecentColor(
const QColor &color );
Registry of color schemes.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)