15 #ifndef QGSCOLORSWATCHGRID_H 
   16 #define QGSCOLORSWATCHGRID_H 
   20 #include <QWidgetAction> 
   47     QSize minimumSizeHint() 
const override;
 
   50     QSize sizeHint() 
const override;
 
   57     QString 
context()
 const { 
return mContext; }
 
   64     void setContext( 
const QString &context );
 
   78     void setBaseColor( 
const QColor &baseColor );
 
  109     void paintEvent( QPaintEvent *event ) 
override;
 
  110     void mouseMoveEvent( QMouseEvent *event ) 
override;
 
  111     void mousePressEvent( QMouseEvent *event ) 
override;
 
  112     void mouseReleaseEvent( QMouseEvent *event ) 
override;
 
  113     void keyPressEvent( QKeyEvent *event ) 
override;
 
  114     void focusInEvent( QFocusEvent *event ) 
override;
 
  115     void focusOutEvent( QFocusEvent *event ) 
override;
 
  123     bool mDrawBoxDepressed;
 
  124     int mCurrentHoverBox;
 
  127     int mCurrentFocusBox;
 
  131     int mLabelHeight = 0;
 
  133     int mLabelMargin = 0;
 
  138     int mSwatchOutlineSize = 0;
 
  141     int mSwatchMargin = 0;
 
  144     int mSwatchSpacing = 0;
 
  146     bool mPressedOnWidget;
 
  152     int calculateHeight() 
const;
 
  158     void draw( QPainter &painter );
 
  165     int swatchForPosition( QPoint position ) 
const;
 
  171     void updateTooltip( 
int colorIdx );
 
  177     QPixmap transparentBackground();
 
  209     void setBaseColor( 
const QColor &baseColor );
 
  216     QColor baseColor() 
const;
 
  223     QString context() 
const;
 
  230     void setContext( 
const QString &context );
 
  256     void refreshColors();
 
  267     QMenu *mMenu = 
nullptr;
 
  271     bool mSuppressRecurse;
 
  272     bool mDismissOnColorSelection;
 
  279     void setColor( 
const QColor &color );
 
Abstract base class for color schemes.
A color swatch grid which can be embedded into a menu.
void setDismissOnColorSelection(bool dismiss)
Sets whether the parent menu should be dismissed and closed when a color is selected from the action'...
void colorChanged(const QColor &color)
Emitted when a color has been selected from the widget.
bool dismissOnColorSelection() const
Returns whether the parent menu will be dismissed after a color is selected from the action's color w...
A grid of color swatches, which allows for user selection.
QgsNamedColorList * colors()
Gets the list of colors shown in the grid.
QColor baseColor() const
Gets the base color for the widget.
void colorChanged(const QColor &color)
Emitted when a color has been selected from the widget.
void hovered()
Emitted when mouse hovers over widget.
QString context() const
Gets the current context for the grid.
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.