QSint Library  0.2.2
Public Types | Signals | Public Member Functions | Static Public Member Functions | List of all members
QSint::ColorGrid Class Reference

Class for visual selection of a color from the color grid. More...

#include <colorgrid.h>

Inherits QWidget.

Public Types

enum  ClickMode { CM_PRESS, CM_RELEASE }
 Defines color selection behavior. More...
 

Signals

void highlighted (const QColor &color)
 
void picked (const QColor &color)
 

Public Member Functions

 ColorGrid (QWidget *parent=0)
 
virtual ~ColorGrid ()
 
int cellSize () const
 
void setCellSize (int size)
 
int widthInCells () const
 
void setWidthInCells (int width)
 
int heightInCells () const
 
bool autoSize () const
 
void setAutoSize (bool autosize)
 
const QColor & lastHighlighted () const
 
const QColor & lastPicked () const
 
bool pickByDrag () const
 
void setPickByDrag (bool set)
 
ClickMode clickMode () const
 
void setClickMode (ClickMode mode)
 
ColorList * scheme () const
 
void setScheme (ColorList *scheme)
 

Static Public Member Functions

static ColorList * defaultColors ()
 
static ColorList * defaultColors2 ()
 
static ColorList * baseColors ()
 
static ColorList * namedColors ()
 

Detailed Description

Class for visual selection of a color from the color grid.

ColorGrid.png
An example of ColorGrid

ColorGrid can use a custom (user-defined) color scheme, as well as one of pre-defined ones (see setScheme() function). Also, the size of color cells and their layout can be customized.

A color can be picked from the grid with the mouse or with the cursor and Enter keys (see setPickByDrag() and setClickMode() functions).

Signal picked() is emitted when the user picks a color from the grid. Signal highlighted() is emitted when the user moves mouse cursor over the grid.

Member Enumeration Documentation

Defines color selection behavior.

Enumerator
CM_PRESS 

a color is picked when mouse button has been pressed

CM_RELEASE 

a color is picked when mouse button has been released

Constructor & Destructor Documentation

QSint::ColorGrid::ColorGrid ( QWidget *  parent = 0)

Constructor.

QSint::ColorGrid::~ColorGrid ( )
virtual

Destructor.

Member Function Documentation

bool QSint::ColorGrid::autoSize ( ) const
inline

Returns true if autosize has been enabled.

See Also
setAutoSize()
ColorList * QSint::ColorGrid::baseColors ( )
static

Returns default color scheme based on 16 base colors.

See Also
setScheme()
int QSint::ColorGrid::cellSize ( ) const
inline

Returns size of a color cell in pixels.

ClickMode QSint::ColorGrid::clickMode ( ) const
inline

Returns currently active color picking mode.

See Also
setClickMode()
ColorList * QSint::ColorGrid::defaultColors ( )
static

Returns default color scheme.

See Also
setScheme()
ColorList * QSint::ColorGrid::defaultColors2 ( )
static

Returns second default color scheme.

See Also
setScheme()
int QSint::ColorGrid::heightInCells ( ) const

Returns height of the grid in cells.

void QSint::ColorGrid::highlighted ( const QColor &  color)
signal

Emitted when user moves mouse cursor over the grid or changes selection with the cursor keys.

color is the color value under the cursor.

const QColor& QSint::ColorGrid::lastHighlighted ( ) const
inline

Returns a recently highlighted color.

See Also
highlighted()
const QColor& QSint::ColorGrid::lastPicked ( ) const
inline

Returns a recently picked color.

See Also
picked()
ColorList * QSint::ColorGrid::namedColors ( )
static

Returns default color scheme based on QColor::colorNames() list.

See Also
setScheme()
bool QSint::ColorGrid::pickByDrag ( ) const
inline

Returns true if pick-by-drag mode has been enabled.

See Also
setPickByDrag()
void QSint::ColorGrid::picked ( const QColor &  color)
signal

Emitted when user picks a color from the grid.

color is the picked color value.

ColorList* QSint::ColorGrid::scheme ( ) const
inline

Returns currently active color scheme (by default, defaultColors() is used).

See Also
setScheme()
void QSint::ColorGrid::setAutoSize ( bool  autosize)

Sets autosize mode to autosize (disabled by default).

If autosize mode is enabled, the size of the grid is calculated automatically based on number of colors in the current color scheme. In this mode, calls to setWidthInCells() are ignored.

void QSint::ColorGrid::setCellSize ( int  size)

Sets size of a color cell in pixels to size (must be > 0).

void QSint::ColorGrid::setClickMode ( ClickMode  mode)
inline

Sets color picking mode to mode.

void QSint::ColorGrid::setPickByDrag ( bool  set)
inline

Sets pick-by-drag mode to set (disabled by default).

If pick-by-drag mode is enabled, then signal picked() is emitted when the user drags mouse over the grid with pressed mouse button.

void QSint::ColorGrid::setScheme ( ColorList *  scheme)

Sets color scheme to scheme.

void QSint::ColorGrid::setWidthInCells ( int  width)

Sets width of the grid in cells to width (must be > 0).

int QSint::ColorGrid::widthInCells ( ) const
inline

Returns width of the grid in cells.


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

© Sintegrial Technologies 2011-2014
http://www.sintegrial.com