|
QSint Library
0.2.2
|
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 () |
Class for visual selection of a color from the color grid.
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.
| QSint::ColorGrid::ColorGrid | ( | QWidget * | parent = 0 | ) |
Constructor.
|
virtual |
Destructor.
|
inline |
Returns true if autosize has been enabled.
|
static |
Returns default color scheme based on 16 base colors.
|
inline |
Returns size of a color cell in pixels.
|
inline |
Returns currently active color picking mode.
|
static |
Returns default color scheme.
|
static |
Returns second default color scheme.
| int QSint::ColorGrid::heightInCells | ( | ) | const |
Returns height of the grid in cells.
|
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.
|
inline |
Returns a recently highlighted color.
|
inline |
Returns a recently picked color.
|
static |
Returns default color scheme based on QColor::colorNames() list.
|
inline |
Returns true if pick-by-drag mode has been enabled.
|
signal |
Emitted when user picks a color from the grid.
color is the picked color value.
|
inline |
Returns currently active color scheme (by default, defaultColors() is used).
| 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).
|
inline |
Sets color picking mode to mode.
|
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).
|
inline |
Returns width of the grid in cells.