QGIS API Documentation  2.7.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules 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>

Inheritance diagram for QgsColorSwatchGrid:
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...
 
void hovered ()
 Emitted when mouse hovers over widget. More...
 

Public Member Functions

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

Protected Member Functions

void focusInEvent (QFocusEvent *event)
 
void focusOutEvent (QFocusEvent *event)
 
void keyPressEvent (QKeyEvent *event)
 
void mouseMoveEvent (QMouseEvent *event)
 
void mousePressEvent (QMouseEvent *event)
 
void mouseReleaseEvent (QMouseEvent *event)
 
void paintEvent (QPaintEvent *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

Definition at line 29 of file qgscolorswatchgrid.h.

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

Definition at line 33 of file qgscolorswatchgrid.cpp.

QgsColorSwatchGrid::~QgsColorSwatchGrid ( )
virtual

Definition at line 55 of file qgscolorswatchgrid.cpp.

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

Definition at line 66 of file qgscolorswatchgrid.h.

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

Definition at line 77 of file qgscolorswatchgrid.h.

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

Definition at line 54 of file qgscolorswatchgrid.h.

void QgsColorSwatchGrid::focusInEvent ( QFocusEvent *  event)
protected

Definition at line 231 of file qgscolorswatchgrid.cpp.

void QgsColorSwatchGrid::focusOutEvent ( QFocusEvent *  event)
protected

Definition at line 238 of file qgscolorswatchgrid.cpp.

void QgsColorSwatchGrid::hovered ( )
signal

Emitted when mouse hovers over widget.

void QgsColorSwatchGrid::keyPressEvent ( QKeyEvent *  event)
protected

Definition at line 172 of file qgscolorswatchgrid.cpp.

QSize QgsColorSwatchGrid::minimumSizeHint ( ) const
virtual

Definition at line 60 of file qgscolorswatchgrid.cpp.

void QgsColorSwatchGrid::mouseMoveEvent ( QMouseEvent *  event)
protected

Definition at line 100 of file qgscolorswatchgrid.cpp.

void QgsColorSwatchGrid::mousePressEvent ( QMouseEvent *  event)
protected

Definition at line 139 of file qgscolorswatchgrid.cpp.

void QgsColorSwatchGrid::mouseReleaseEvent ( QMouseEvent *  event)
protected

Definition at line 150 of file qgscolorswatchgrid.cpp.

void QgsColorSwatchGrid::paintEvent ( QPaintEvent *  event)
protected

Definition at line 92 of file qgscolorswatchgrid.cpp.

void QgsColorSwatchGrid::refreshColors ( )
slot

Reload colors from scheme and redraws the widget.

Definition at line 82 of file qgscolorswatchgrid.cpp.

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

Definition at line 76 of file qgscolorswatchgrid.cpp.

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

Definition at line 70 of file qgscolorswatchgrid.cpp.

QSize QgsColorSwatchGrid::sizeHint ( ) const
virtual

Definition at line 65 of file qgscolorswatchgrid.cpp.


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