15 #ifndef QGSCOLORSWATCHGRID_H 16 #define QGSCOLORSWATCHGRID_H 20 #include <QWidgetAction> 45 virtual QSize minimumSizeHint()
const override;
48 virtual QSize sizeHint()
const override;
54 QString
context()
const {
return mContext; }
60 void setContext(
const QString &context );
72 void setBaseColor(
const QColor &baseColor );
90 void colorChanged(
const QColor &color );
99 void paintEvent( QPaintEvent * event )
override;
100 void mouseMoveEvent( QMouseEvent * event )
override;
101 void mousePressEvent( QMouseEvent * event )
override;
102 void mouseReleaseEvent( QMouseEvent * event )
override;
103 void keyPressEvent( QKeyEvent* event )
override;
104 void focusInEvent( QFocusEvent* event )
override;
105 void focusOutEvent( QFocusEvent* event )
override;
113 bool mDrawBoxDepressed;
114 int mCurrentHoverBox;
117 int mCurrentFocusBox;
121 bool mPressedOnWidget;
126 int calculateHeight()
const;
131 void draw( QPainter &painter );
137 int swatchForPosition(
const QPoint &position )
const;
142 void updateTooltip(
const int colorIdx );
147 const QPixmap &transparentBackground();
178 void setBaseColor(
const QColor &baseColor );
184 QColor baseColor()
const;
190 QString context()
const;
196 void setContext(
const QString &context );
202 void refreshColors();
209 void colorChanged(
const QColor &color );
216 bool mSuppressRecurse;
222 void setColor(
const QColor &color );
Abstract base class for color schemes.
QList< QPair< QColor, QString > > QgsNamedColorList
List of colors paired with a friendly display name identifying the color.
A grid of color swatches, which allows for user selection.
QgsNamedColorList * colors()
Gets the list of colors shown in the grid.
QString context() const
Get the current context for the grid.
QColor baseColor() const
Get the base color for the widget.