FlowVis 1.0
|
The QtColorTriangle class provides a triangular color selection widget. More...
Public Slots | |
void | setColor (const QColor &col) |
Signals | |
void | colorChanged (const QColor &col) |
Public Member Functions | |
QtColorTriangle (QWidget *parent=0) | |
~QtColorTriangle () | |
QSize | sizeHint () const |
int | heightForWidth (int w) const |
void | polish () |
QColor | color () const |
Protected Member Functions | |
void | paintEvent (QPaintEvent *) |
void | mouseMoveEvent (QMouseEvent *) |
void | mousePressEvent (QMouseEvent *) |
void | mouseReleaseEvent (QMouseEvent *) |
void | keyPressEvent (QKeyEvent *e) |
void | resizeEvent (QResizeEvent *) |
void | drawTrigon (QImage *p, const QPointF &a, const QPointF &b, const QPointF &c, const QColor &color) |
Private Types | |
enum | SelectionMode { Idle, SelectingHue, SelectingSatValue } |
Private Member Functions | |
double | radiusAt (const QPointF &pos, const QRect &rect) const |
double | angleAt (const QPointF &pos, const QRect &rect) const |
QPointF | movePointToTriangle (double x, double y, const Vertex &a, const Vertex &b, const Vertex &c) const |
QPointF | pointFromColor (const QColor &col) const |
QColor | colorFromPoint (const QPointF &p) const |
void | genBackground () |
Private Attributes | |
QImage | bg |
double | a |
double | b |
double | c |
QPointF | pa |
QPointF | pb |
QPointF | pc |
QPointF | pd |
QColor | curColor |
int | curHue |
bool | mustGenerateBackground |
int | penWidth |
int | ellipseSize |
int | outerRadius |
QPointF | selectorPos |
enum QtColorTriangle::SelectionMode | selMode |
The QtColorTriangle class provides a triangular color selection widget.
This widget uses the HSV color model, and is therefore useful for selecting colors by eye.
The triangle in the center of the widget is used for selecting saturation and value, and the surrounding circle is used for selecting hue.
Use setColor() and color() to set and get the current color.
colortriangle.png
Definition at line 71 of file qtcolortriangle.h.
QtColorTriangle::QtColorTriangle | ( | QWidget * | parent = 0 | ) |
Constructs a color triangle widget with the given parent.
Definition at line 132 of file qtcolortriangle.cpp.
QtColorTriangle::~QtColorTriangle | ( | ) |
Destructs the color triangle.
Definition at line 148 of file qtcolortriangle.cpp.
QtColorTriangle::colorChanged | ( | const QColor & | color | ) | [signal] |
Whenever the color triangles color changes this signal is emitted with the new color.
int QtColorTriangle::heightForWidth | ( | int | w | ) | const |
Forces the triangle widget to always be square. Returns the value w.
Definition at line 195 of file qtcolortriangle.cpp.
void QtColorTriangle::paintEvent | ( | QPaintEvent * | e | ) | [protected] |
First copies a background image of the hue donut and its background color onto the frame, then draws the color triangle, and finally the selectors.
Definition at line 527 of file qtcolortriangle.cpp.
QSize QtColorTriangle::sizeHint | ( | ) | const |
Definition at line 186 of file qtcolortriangle.cpp.