15#ifndef QGSCOLORBUTTON_H
16#define QGSCOLORBUTTON_H
18#include <QColorDialog>
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; }
210 void setShowNull(
bool showNull,
const QString &nullString = QString() );
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();
419 bool event( QEvent *e )
override;
420 void changeEvent( QEvent *e )
override;
421 void showEvent( QShowEvent *e )
override;
422 void resizeEvent( QResizeEvent *event )
override;
427 static const QPixmap &transparentBackground();
432 void mousePressEvent( QMouseEvent *e )
override;
437 void mouseMoveEvent( QMouseEvent *e )
override;
442 void mouseReleaseEvent( QMouseEvent *e )
override;
447 void keyPressEvent( QKeyEvent *e )
override;
452 void dragEnterEvent( QDragEnterEvent *e )
override;
457 void dragLeaveEvent( QDragLeaveEvent *e )
override;
462 void dropEvent( QDropEvent *e )
override;
464 void wheelEvent( QWheelEvent *event )
override;
469 QString mColorDialogTitle;
475 QColor mDefaultColor;
478 QColor mCurrentColor;
481 bool mAllowOpacity =
false;
482 bool mColorSet =
false;
484 bool mShowNoColorOption =
false;
485 QString mNoColorString;
486 bool mShowNull =
false;
487 QString mNullColorString;
489 QPoint mDragStartPosition;
490 bool mPickingColor =
false;
492 QMenu *mMenu =
nullptr;
495 QString mLinkedColorName;
496 bool mShowMenu =
true;
506 bool colorFromMimeData(
const QMimeData *mimeData, QColor &resultColor );
514 void stopPicking( QPoint eventPos,
bool samplingColor =
true );
516 QColor linkedProjectColor()
const;
520 void buttonClicked();
522 void showColorDialog();
527 void setValidColor(
const QColor &newColor );
533 void setValidTemporaryColor(
const QColor &newColor );
539 void addRecentColor(
const QColor &color );
Registry of color schemes.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)