Skip to content

Commit

Permalink
Move QgsColorButton::createMenuIcon to public API, make static
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jan 11, 2019
1 parent 938adb8 commit 79d01a9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
10 changes: 10 additions & 0 deletions python/gui/auto_generated/qgscolorbutton.sip.in
Expand Up @@ -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:
Expand Down
18 changes: 10 additions & 8 deletions src/gui/qgscolorbutton.h
Expand Up @@ -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:

/**
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 79d01a9

Please sign in to comment.