QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Slots | Signals | Public Member Functions | Protected Member Functions | List of all members
QgsColorSwatchGrid Class Reference

A grid of color swatches, which allows for user selection. 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.
void hovered ()
 Emitted when mouse hovers over widget.

Public Member Functions

 QgsColorSwatchGrid (QgsColorScheme *scheme, QString context=QString(), QWidget *parent=0)
 Construct a new color swatch grid.
virtual ~QgsColorSwatchGrid ()
virtual QSize minimumSizeHint () const
virtual QSize sizeHint () const
QString context () const
 Get the current context for the grid.
void setContext (const QString context)
 Sets the current context for the grid.
QColor baseColor () const
 Get the base color for the widget.
void setBaseColor (const QColor baseColor)
 Sets the base color for the widget.
QgsNamedColorListcolors ()
 Gets the list of colors shown in the grid.

Protected Member Functions

void paintEvent (QPaintEvent *event)
void mouseMoveEvent (QMouseEvent *event)
void mousePressEvent (QMouseEvent *event)
void mouseReleaseEvent (QMouseEvent *event)
void keyPressEvent (QKeyEvent *event)
void focusInEvent (QFocusEvent *event)
void focusOutEvent (QFocusEvent *event)

Detailed Description

A grid of color swatches, which allows for user selection.

Colors are taken from an associated QgsColorScheme.

See Also
QgsColorGridAction
Note
introduced in QGIS 2.5

Constructor & Destructor Documentation

QgsColorSwatchGrid::QgsColorSwatchGrid ( QgsColorScheme scheme,
QString  context = QString(),
QWidget *  parent = 0 
)

Construct a new color swatch grid.

Parameters
schemeQgsColorScheme for colors to show in grid
contextcontext string provided to color scheme
parentparent widget
QgsColorSwatchGrid::~QgsColorSwatchGrid ( )
virtual

Member Function Documentation

QColor QgsColorSwatchGrid::baseColor ( ) const
inline

Get the base color for the widget.

Returns
base color which is passed to scheme for color generation
See Also
setBaseColor
void QgsColorSwatchGrid::colorChanged ( const QColor  color)
signal

Emitted when a color has been selected from the widget.

Parameters
colorselected color
QgsNamedColorList* QgsColorSwatchGrid::colors ( )
inline

Gets the list of colors shown in the grid.

Returns
list of colors currently shown in the grid
QString QgsColorSwatchGrid::context ( ) const
inline

Get the current context for the grid.

Returns
context string which is passed to scheme for color generation
See Also
setContext
void QgsColorSwatchGrid::focusInEvent ( QFocusEvent *  event)
protected
void QgsColorSwatchGrid::focusOutEvent ( QFocusEvent *  event)
protected
void QgsColorSwatchGrid::hovered ( )
signal

Emitted when mouse hovers over widget.

void QgsColorSwatchGrid::keyPressEvent ( QKeyEvent *  event)
protected
QSize QgsColorSwatchGrid::minimumSizeHint ( ) const
virtual
void QgsColorSwatchGrid::mouseMoveEvent ( QMouseEvent *  event)
protected
void QgsColorSwatchGrid::mousePressEvent ( QMouseEvent *  event)
protected
void QgsColorSwatchGrid::mouseReleaseEvent ( QMouseEvent *  event)
protected
void QgsColorSwatchGrid::paintEvent ( QPaintEvent *  event)
protected
void QgsColorSwatchGrid::refreshColors ( )
slot

Reload colors from scheme and redraws the widget.

void QgsColorSwatchGrid::setBaseColor ( const QColor  baseColor)

Sets the base color for the widget.

Parameters
baseColorbase color to pass to scheme for color generation
See Also
baseColor
void QgsColorSwatchGrid::setContext ( const QString  context)

Sets the current context for the grid.

Parameters
contextstring which is passed to scheme for color generation
See Also
context
QSize QgsColorSwatchGrid::sizeHint ( ) const
virtual

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