QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
A color swatch grid which can be embedded into a menu. More...
#include <qgscolorswatchgrid.h>
Public Slots | |
void | refreshColors () |
Reload colors from scheme and redraws the widget. | |
Signals | |
void | colorChanged (const QColor &color) |
Emitted when a color has been selected from the widget. | |
Public Member Functions | |
QgsColorSwatchGridAction (QgsColorScheme *scheme, QMenu *menu=nullptr, const QString &context=QString(), QWidget *parent=nullptr) | |
Construct a new color swatch grid action. | |
QColor | baseColor () const |
Gets the base color for the color grid. | |
QString | context () const |
Gets the current context for the color grid. | |
bool | dismissOnColorSelection () const |
Returns whether the parent menu will be dismissed after a color is selected from the action's color widget. | |
void | setBaseColor (const QColor &baseColor) |
Sets the base color for the color grid. | |
void | setContext (const QString &context) |
Sets the current context for the color grid. | |
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. | |
A color swatch grid which can be embedded into a menu.
Definition at line 187 of file qgscolorswatchgrid.h.
QgsColorSwatchGridAction::QgsColorSwatchGridAction | ( | QgsColorScheme * | scheme, |
QMenu * | menu = nullptr , |
||
const QString & | context = QString() , |
||
QWidget * | parent = nullptr |
||
) |
Construct a new color swatch grid action.
scheme | QgsColorScheme for colors to show in grid |
menu | parent menu |
context | context string provided to color scheme |
parent | parent widget |
Definition at line 359 of file qgscolorswatchgrid.cpp.
QColor QgsColorSwatchGridAction::baseColor | ( | ) | const |
Gets the base color for the color grid.
Definition at line 382 of file qgscolorswatchgrid.cpp.
|
signal |
Emitted when a color has been selected from the widget.
color | selected color |
QString QgsColorSwatchGridAction::context | ( | ) | const |
Gets the current context for the color grid.
Definition at line 387 of file qgscolorswatchgrid.cpp.
|
inline |
Returns whether the parent menu will be dismissed after a color is selected from the action's color widget.
Definition at line 244 of file qgscolorswatchgrid.h.
|
slot |
Reload colors from scheme and redraws the widget.
Definition at line 397 of file qgscolorswatchgrid.cpp.
void QgsColorSwatchGridAction::setBaseColor | ( | const QColor & | baseColor | ) |
Sets the base color for the color grid.
baseColor | base color to pass to scheme for color generation |
Definition at line 377 of file qgscolorswatchgrid.cpp.
void QgsColorSwatchGridAction::setContext | ( | const QString & | context | ) |
Sets the current context for the color grid.
context | string which is passed to scheme for color generation |
Definition at line 392 of file qgscolorswatchgrid.cpp.
|
inline |
Sets whether the parent menu should be dismissed and closed when a color is selected from the action's color widget.
dismiss | set 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. |
Definition at line 237 of file qgscolorswatchgrid.h.