QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
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 189 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 395 of file qgscolorswatchgrid.cpp.
QColor QgsColorSwatchGridAction::baseColor | ( | ) | const |
Gets the base color for the color grid.
Definition at line 418 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 423 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 249 of file qgscolorswatchgrid.h.
|
slot |
Reload colors from scheme and redraws the widget.
Definition at line 433 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 413 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 428 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 241 of file qgscolorswatchgrid.h.