QGIS API Documentation 3.28.0-Firenze (ed3ad0430f)
Public Slots | Signals | Public Member Functions | List of all members
QgsColorSwatchGridAction Class Reference

A color swatch grid which can be embedded into a menu. More...

#include <qgscolorswatchgrid.h>

Inheritance diagram for QgsColorSwatchGridAction:
Inheritance graph
[legend]

Public Slots

void refreshColors ()
 Reload colors from scheme and redraws the widget. More...
 

Signals

void colorChanged (const QColor &color)
 Emitted when a color has been selected from the widget. More...
 

Public Member Functions

 QgsColorSwatchGridAction (QgsColorScheme *scheme, QMenu *menu=nullptr, const QString &context=QString(), QWidget *parent=nullptr)
 Construct a new color swatch grid action. More...
 
QColor baseColor () const
 Gets the base color for the color grid. More...
 
QString context () const
 Gets the current context for the color grid. More...
 
bool dismissOnColorSelection () const
 Returns whether the parent menu will be dismissed after a color is selected from the action's color widget. More...
 
void setBaseColor (const QColor &baseColor)
 Sets the base color for the color grid. More...
 
void setContext (const QString &context)
 Sets the current context for the color grid. More...
 
void setDismissOnColorSelection (bool dismiss)
 Sets whether the parent menu should be dismissed and closed when a color is selected from the action's color widget. More...
 

Detailed Description

A color swatch grid which can be embedded into a menu.

See also
QgsColorSwatchGrid
Since
QGIS 2.5

Definition at line 189 of file qgscolorswatchgrid.h.

Constructor & Destructor Documentation

◆ QgsColorSwatchGridAction()

QgsColorSwatchGridAction::QgsColorSwatchGridAction ( QgsColorScheme scheme,
QMenu *  menu = nullptr,
const QString &  context = QString(),
QWidget *  parent = nullptr 
)

Construct a new color swatch grid action.

Parameters
schemeQgsColorScheme for colors to show in grid
menuparent menu
contextcontext string provided to color scheme
parentparent widget

Definition at line 395 of file qgscolorswatchgrid.cpp.

Member Function Documentation

◆ baseColor()

QColor QgsColorSwatchGridAction::baseColor ( ) const

Gets the base color for the color grid.

Returns
base color which is passed to scheme for color generation
See also
setBaseColor

Definition at line 418 of file qgscolorswatchgrid.cpp.

◆ colorChanged

void QgsColorSwatchGridAction::colorChanged ( const QColor &  color)
signal

Emitted when a color has been selected from the widget.

Parameters
colorselected color

◆ context()

QString QgsColorSwatchGridAction::context ( ) const

Gets the current context for the color grid.

Returns
context string which is passed to scheme for color generation
See also
setContext

Definition at line 423 of file qgscolorswatchgrid.cpp.

◆ dismissOnColorSelection()

bool QgsColorSwatchGridAction::dismissOnColorSelection ( ) const
inline

Returns whether the parent menu will be dismissed after a color is selected from the action's color widget.

See also
setDismissOnColorSelection
Since
QGIS 2.14

Definition at line 249 of file qgscolorswatchgrid.h.

◆ refreshColors

void QgsColorSwatchGridAction::refreshColors ( )
slot

Reload colors from scheme and redraws the widget.

Definition at line 433 of file qgscolorswatchgrid.cpp.

◆ setBaseColor()

void QgsColorSwatchGridAction::setBaseColor ( const QColor &  baseColor)

Sets the base color for the color grid.

Parameters
baseColorbase color to pass to scheme for color generation
See also
baseColor

Definition at line 413 of file qgscolorswatchgrid.cpp.

◆ setContext()

void QgsColorSwatchGridAction::setContext ( const QString &  context)

Sets the current context for the color grid.

Parameters
contextstring which is passed to scheme for color generation
See also
context

Definition at line 428 of file qgscolorswatchgrid.cpp.

◆ setDismissOnColorSelection()

void QgsColorSwatchGridAction::setDismissOnColorSelection ( bool  dismiss)
inline

Sets whether the parent menu should be dismissed and closed when a color is selected from the action's color widget.

Parameters
dismissset to true (default) to immediately close the menu when a color is selected from the widget. If set to false, the colorChanged signal will be emitted but the menu will stay open.
See also
dismissOnColorSelection()
Since
QGIS 2.14

Definition at line 241 of file qgscolorswatchgrid.h.


The documentation for this class was generated from the following files: