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 );
99 void colorChanged(
const QColor &color );
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();
264 void colorChanged(
const QColor &color );
267 QMenu *mMenu =
nullptr;
271 bool mSuppressRecurse;
272 bool mDismissOnColorSelection;
279 void setColor(
const QColor &color );