Move QgsColorButton::createMenuIcon to public API, make static

This commit is contained in:
Nyall Dawson 2019-01-11 14:33:46 +10:00
parent 938adb8c17
commit 79d01a9b94
2 changed files with 20 additions and 8 deletions

View File

@ -303,6 +303,16 @@ that are shown in the button's drop-down menu.
swatch grids are hidden from the button's drop-down menu.
.. seealso:: :py:func:`setColorSchemeRegistry`
%End
static QPixmap createMenuIcon( const QColor &color, bool showChecks = true );
%Docstring
Creates an icon for displaying a ``color`` in a drop-down menu.
If ``showChecks`` set to true, then a checkboard pattern will be shown behind
semi-transparent colors.
.. versionadded:: 3.6
%End
public slots:

View File

@ -271,6 +271,16 @@ class GUI_EXPORT QgsColorButton : public QToolButton
*/
QgsColorSchemeRegistry *colorSchemeRegistry() { return mColorSchemeRegistry; }
/**
* Creates an icon for displaying a \a color in a drop-down menu.
*
* If \a showChecks set to true, then a checkboard pattern will be shown behind
* semi-transparent colors.
*
* \since QGIS 3.6
*/
static QPixmap createMenuIcon( const QColor &color, bool showChecks = true );
public slots:
/**
@ -448,14 +458,6 @@ class GUI_EXPORT QgsColorButton : public QToolButton
*/
void stopPicking( QPoint eventPos, bool samplingColor = true );
/**
* Create a color icon for display in the drop-down menu
* \param color for icon
* \param showChecks set to true to display a checkboard pattern behind
* transparent colors
*/
QPixmap createMenuIcon( const QColor &color, bool showChecks = true );
private slots:
void buttonClicked();