Color Scale widget. More...
#include <QtxColorScale.h>

Public Types | |
| enum | Mode { Auto , User } |
| Color scale color/label mode. More... | |
| enum | Position { None , Left , Right , Center } |
| Color scale title, label position. More... | |
| enum | DumpMode { NoDump , TitleDump , ScaleDump , FullDump } |
| Dump mode. More... | |
| enum | Flags { AtBorder = 0x001 , Reverse = 0x002 , Integer = 0x004 , WrapTitle = 0x008 , PreciseFormat = 0x010 , Transparent = 0x020 } |
| Color scale flags (bitwise). More... | |
Public Member Functions | |
| QtxColorScale (QWidget *=0, Qt::WindowFlags=0) | |
| Constructor. More... | |
| QtxColorScale (const int, QWidget *=0, Qt::WindowFlags=0) | |
| Constructor. More... | |
| virtual | ~QtxColorScale () |
| Destructor. More... | |
| double | minimum () const |
| Get color scale minimum value. More... | |
| double | maximum () const |
| Get color scale maximum value. More... | |
| void | range (double &, double &) const |
| Get color scale range. More... | |
| int | dumpMode () const |
| Get Color scale dump mode. More... | |
| int | labelMode () const |
| Get label mode. More... | |
| int | colorMode () const |
| Get color mode. More... | |
| int | intervalsNumber () const |
| Get number of color scale intervals. More... | |
| QString | title () const |
| Get color scale title. More... | |
| QString | format () const |
| Get current format of the number presentation. More... | |
| QString | label (const int) const |
| Get user label for the specified color scale interval. More... | |
| QColor | color (const int) const |
| Get user color for the specified color scale interval. More... | |
| void | labels (QStringList &) const |
| Get user labels for all color scale intervals. More... | |
| void | colors (QList< QColor > &) const |
| Get user colors for all color scale intervals. More... | |
| int | labelPosition () const |
| Get label position. More... | |
| int | titlePosition () const |
| Get title position. More... | |
| void | setMinimum (const double) |
| Set color scale minimum value. More... | |
| void | setMaximum (const double) |
| Set color scale maximum value. More... | |
| void | setRange (const double, const double) |
| Set color scale range. More... | |
| void | setDumpMode (const int) |
| Set color scale dump mode. More... | |
| void | setColorMode (const int) |
| Set color scale color mode. More... | |
| void | setLabelMode (const int) |
| Set color scale label mode. More... | |
| void | setIntervalsNumber (const int) |
| Set number of color scale intervals. More... | |
| void | setTitle (const QString &) |
| Set color scale title. More... | |
| void | setFormat (const QString &) |
| Set current format of the number presentation. More... | |
| void | setLabel (const QString &, const int=-1) |
| Set user label for the specified color scale interval. More... | |
| void | setColor (const QColor &, const int=-1) |
| Set user color for the specified color scale interval. More... | |
| void | setLabels (const QStringList &) |
| Set user labels for all color scale intervals. More... | |
| void | setColors (const QList< QColor > &) |
| Set user colors for all color scale intervals. More... | |
| void | setLabelPosition (const int) |
| Set label position. More... | |
| void | setTitlePosition (const int) |
| Set title position. More... | |
| void | setFlags (const int) |
| Set color scale flags. More... | |
| bool | testFlags (const int) const |
| Test color scale flags. More... | |
| void | clearFlags (const int) |
| Clear (reset) color scale flags. More... | |
| QPixmap | dump () const |
| Dump color scale into pixmap with current size. More... | |
| QPixmap | dump (const int=-1, const int=-1) const |
| Dump color scale into pixmap with the specified size. More... | |
| QPixmap | dump (const QColor &, const int=-1, const int=-1) const |
| Dump color scale into pixmap with the specified size and background color. More... | |
| virtual QSize | minimumSizeHint () const |
| Get widget's minumum size hint. More... | |
| virtual QSize | sizeHint () const |
| Get widget's default size hint. More... | |
| virtual void | show () |
| Show color scale (reimplemented from QFrame). More... | |
| virtual void | hide () |
| Hide color scale (reimplemented from QFrame). More... | |
Protected Member Functions | |
| virtual void | paintEvent (QPaintEvent *) |
| Paint widget. More... | |
| virtual void | drawContents (QPainter *) |
| Draw color scale (reimplemented from QFrame). More... | |
Private Member Functions | |
| void | updateScale () |
| Update color scale. More... | |
| QString | getFormat () const |
| Generate number presentation format. More... | |
| QString | getLabel (const int) const |
| Get color scale label text corresponding to the specified interval. More... | |
| QColor | getColor (const int) const |
| Get color scale color corresponding to the specified interval. More... | |
| double | getNumber (const int) const |
| Get color scale value corresponding to the specified interval. More... | |
| QTextDocument * | textDocument (const int) const |
| Get text document (rich text) for the color scale title representation. More... | |
| void | drawScale (QPainter *, const bool, const int, const int, const int, const int, const bool, const bool, const bool) const |
| Draw color scale contents. More... | |
| void | drawScale (QPainter *, const QColor &, const bool, const int, const int, const int, const int, const bool, const bool, const bool) const |
| Draw color scale contents. More... | |
| QSize | calculateSize (const bool, const int, const bool, const bool, const bool) const |
| Calculate color scale size. More... | |
Private Attributes | |
| double | myMin |
| lower limit More... | |
| double | myMax |
| upper limit More... | |
| QString | myTitle |
| title More... | |
| QString | myFormat |
| number presentation format More... | |
| QString | myPrecise |
| double values precision format More... | |
| int | myInterval |
| number of color scale intervals More... | |
| int | myDumpMode |
| dump mode (QtxColorScale::DumpMode) More... | |
| int | myColorMode |
| color mode (QtxColorScale::Mode) More... | |
| int | myLabelMode |
| label mode (QtxColorScale::Mode) More... | |
| QList< QColor > | myColors |
| list of colors More... | |
| QList< QString > | myLabels |
| list of labels More... | |
| int | myFlags |
| color scale flags (QtxColorScale::Flags) More... | |
| int | myLabelPos |
| label position (QtxColorScale::Position) More... | |
| int | myTitlePos |
| title position (QtxColorScale::Position) More... | |
Color Scale widget.
| enum QtxColorScale::Flags |
Color scale flags (bitwise).
| enum QtxColorScale::Mode |
| QtxColorScale::QtxColorScale | ( | QWidget * | parent = 0, |
| Qt::WindowFlags | f = 0 |
||
| ) |
Constructor.
| parent | parent widget |
| f | widget flags |
| QtxColorScale::QtxColorScale | ( | const int | num, |
| QWidget * | parent = 0, |
||
| Qt::WindowFlags | f = 0 |
||
| ) |
Constructor.
| num | number of color scale intervals |
| parent | parent widget |
| f | widget flags |
|
virtual |
Destructor.
Does nothing for the moment.
|
private |
Calculate color scale size.
| min | if true, color scale size is calculated to be as smallest as possible |
| flags | color scale flags |
| title | color scale title |
| labels | if true take into account labels |
| colors | if true take into account colors |
References AtBorder, colors(), getLabel(), intervalsNumber(), labels(), myFormat, myTitle, textDocument(), and title().
| void QtxColorScale::clearFlags | ( | const int | flags | ) |
Clear (reset) color scale flags.
| flags | color scale flags to be cleared |
References myFlags, and updateScale().
| QColor QtxColorScale::color | ( | const int | idx | ) | const |
Get user color for the specified color scale interval.
| idx | interval index |
References myColors.
| int QtxColorScale::colorMode | ( | ) | const |
| void QtxColorScale::colors | ( | QList< QColor > & | list | ) | const |
Get user colors for all color scale intervals.
| list | returning colors list |
References myColors.
|
protectedvirtual |
Draw color scale (reimplemented from QFrame).
| p | painter |
References drawScale(), labelPosition(), None, and titlePosition().
|
private |
Draw color scale contents.
| p | painter |
| transp | if true color scale is drawn on transparent background |
| X | color scale x coordinate |
| Y | color scale y coordinate |
| W | color scale width |
| H | color scale height |
| drawTitle | if true, draw title |
| drawLabel | if true, draw labels |
| drawColors | if true, draw colors |
References color().
|
private |
Draw color scale contents.
| p | painter |
| bg | background color |
| transp | if true color scale is drawn on transparent background |
| X | color scale x coordinate |
| Y | color scale y coordinate |
| W | color scale width |
| H | color scale height |
| drawTitle | if true, draw title |
| drawLabel | if true, draw labels |
| drawColors | if true, draw colors |
References AtBorder, Center, colors(), getColor(), getLabel(), intervalsNumber(), labelPosition(), labels(), Left, myFlags, Reverse, Right, testFlags(), textDocument(), and title().
| QPixmap QtxColorScale::dump | ( | ) | const |
Dump color scale into pixmap with current size.
References drawScale(), dumpMode(), FullDump, label(), labelPosition(), myDumpMode, NoDump, None, ScaleDump, title(), TitleDump, and titlePosition().
| QPixmap QtxColorScale::dump | ( | const int | w = -1, |
| const int | h = -1 |
||
| ) | const |
| QPixmap QtxColorScale::dump | ( | const QColor & | bg, |
| const int | w = -1, |
||
| const int | h = -1 |
||
| ) | const |
Dump color scale into pixmap with the specified size and background color.
| bg | pixmap background color |
| w | pixmap width |
| h | pixmap height |
References calculateSize(), drawScale(), dumpMode(), FullDump, label(), labelPosition(), myDumpMode, myFlags, NoDump, None, ScaleDump, title(), TitleDump, titlePosition(), and WrapTitle.
| int QtxColorScale::dumpMode | ( | ) | const |
Get Color scale dump mode.
References myDumpMode.
| QString QtxColorScale::format | ( | ) | const |
Get current format of the number presentation.
This format is used to output values in the color scale labels in "Auto" label mode. The format uses sprintf specification.
References myFormat.
|
private |
Get color scale color corresponding to the specified interval.
| idx | interval index |
References color(), colorMode(), intervalsNumber(), Qtx::scaleColor(), and User.
|
private |
Generate number presentation format.
References format(), getNumber(), Integer, intervalsNumber(), myPrecise, PreciseFormat, and testFlags().
|
private |
Get color scale label text corresponding to the specified interval.
| idx | interval index |
References getFormat(), getNumber(), Integer, label(), labelMode(), testFlags(), and User.
|
private |
Get color scale value corresponding to the specified interval.
| idx | interval index |
References intervalsNumber(), maximum(), and minimum().
|
virtual |
Hide color scale (reimplemented from QFrame).
| int QtxColorScale::intervalsNumber | ( | ) | const |
| QString QtxColorScale::label | ( | const int | idx | ) | const |
Get user label for the specified color scale interval.
| idx | interval index |
References myLabels.
| int QtxColorScale::labelMode | ( | ) | const |
| int QtxColorScale::labelPosition | ( | ) | const |
| void QtxColorScale::labels | ( | QStringList & | list | ) | const |
Get user labels for all color scale intervals.
| list | returning labels list |
References myLabels.
| double QtxColorScale::maximum | ( | ) | const |
| double QtxColorScale::minimum | ( | ) | const |
|
virtual |
Get widget's minumum size hint.
References calculateSize(), labelPosition(), myFlags, None, and titlePosition().
|
protectedvirtual |
| void QtxColorScale::range | ( | double & | min, |
| double & | max | ||
| ) | const |
| void QtxColorScale::setColor | ( | const QColor & | clr, |
| const int | idx = -1 |
||
| ) |
Set user color for the specified color scale interval.
If number of interval is negative then user color will be added as new to the end of list.
| clr | user color |
| idx | interval index |
References myColors, and updateScale().
| void QtxColorScale::setColorMode | ( | const int | mode | ) |
Set color scale color mode.
| mode | new color mode (QtxColorScale::Mode) |
References myColorMode, and updateScale().
| void QtxColorScale::setColors | ( | const QList< QColor > & | list | ) |
Set user colors for all color scale intervals.
| list | new colors list |
References myColors, and updateScale().
| void QtxColorScale::setDumpMode | ( | const int | mode | ) |
Set color scale dump mode.
| mode | new dump mode (QtxColorScale::DumpMode) |
References myDumpMode.
| void QtxColorScale::setFlags | ( | const int | flags | ) |
| void QtxColorScale::setFormat | ( | const QString & | format | ) |
Set current format of the number presentation.
| format | new number presentation format |
References Auto, colorMode(), format(), myFormat, myPrecise, and updateScale().
| void QtxColorScale::setIntervalsNumber | ( | const int | num | ) |
Set number of color scale intervals.
| num | number of intervals |
References myInterval, myPrecise, and updateScale().
| void QtxColorScale::setLabel | ( | const QString & | txt, |
| const int | idx = -1 |
||
| ) |
Set user label for the specified color scale interval.
If number of interval is negative then user label will be added as new to the end of list.
| txt | user label |
| idx | interval index |
References myLabels, and updateScale().
| void QtxColorScale::setLabelMode | ( | const int | mode | ) |
Set color scale label mode.
| mode | new label mode (QtxColorScale::Mode) |
References myLabelMode, and updateScale().
| void QtxColorScale::setLabelPosition | ( | const int | pos | ) |
Set label position.
| pos | new label position (QtxColorScale::Position) |
References Center, myLabelPos, None, and updateScale().
| void QtxColorScale::setLabels | ( | const QStringList & | list | ) |
Set user labels for all color scale intervals.
| list | new labels list |
References myLabels, and updateScale().
| void QtxColorScale::setMaximum | ( | const double | val | ) |
Set color scale maximum value.
| val | upper limit of the color scale |
References minimum(), and setRange().
| void QtxColorScale::setMinimum | ( | const double | val | ) |
Set color scale minimum value.
| val | lower limit of the color scale |
References maximum(), and setRange().
| void QtxColorScale::setRange | ( | const double | min, |
| const double | max | ||
| ) |
Set color scale range.
| min | lower limit of the color scale |
| max | upper limit of the color scale |
References Auto, colorMode(), labelMode(), myMax, myMin, myPrecise, and updateScale().
| void QtxColorScale::setTitle | ( | const QString & | str | ) |
| void QtxColorScale::setTitlePosition | ( | const int | pos | ) |
Set title position.
| pos | new title position (QtxColorScale::Position) |
References Center, myTitlePos, None, and updateScale().
|
virtual |
Show color scale (reimplemented from QFrame).
|
virtual |
Get widget's default size hint.
References calculateSize(), labelPosition(), myFlags, None, and titlePosition().
| bool QtxColorScale::testFlags | ( | const int | flags | ) | const |
|
private |
Get text document (rich text) for the color scale title representation.
If title is not defined (empty string) then null pointer is returned. The calling function is responsible for the returning object deleting.
| flags | color scale flags (not used) |
References Center, Left, None, Right, title(), and titlePosition().
| QString QtxColorScale::title | ( | ) | const |
| int QtxColorScale::titlePosition | ( | ) | const |
|
private |
Update color scale.
|
private |
color mode (QtxColorScale::Mode)
|
private |
list of colors
|
private |
dump mode (QtxColorScale::DumpMode)
|
private |
color scale flags (QtxColorScale::Flags)
|
private |
number presentation format
|
private |
number of color scale intervals
|
private |
label mode (QtxColorScale::Mode)
|
private |
label position (QtxColorScale::Position)
|
private |
list of labels
|
private |
upper limit
|
private |
lower limit
|
private |
double values precision format
|
private |
title
|
private |
title position (QtxColorScale::Position)