![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
The QRoundProgressBar class represents a circular progress bar and maintains its API similar to the QProgressBar. More...
#include <QRoundProgressBar.h>


Public Types | |
| enum | BarStyle { StyleDonut , StylePie , StyleLine } |
| The BarStyle enum defines general look of the progress bar. More... | |
Public Slots | |
| void | setRange (double min, double max) |
| Defines minimum und maximum of the allowed value range. If the current value does not fit into the range, it will be automatically adjusted. More... | |
| void | setMinimum (double min) |
| Defines minimum of the allowed value range. If the current value does not fit into the range, it will be automatically adjusted. More... | |
| void | setMaximum (double max) |
| Defines maximum of the allowed value range. If the current value does not fit into the range, it will be automatically adjusted. More... | |
| void | setValue (double val) |
| Sets a value which will be shown on the widget. More... | |
| void | setValue (int val) |
| Integer version of the previous slot. More... | |
Public Member Functions | |
| QRoundProgressBar (QWidget *parent=0) | |
| double | nullPosition () const |
| Return position (in degrees) of minimum value. More... | |
| void | setNullPosition (double position) |
| Defines position of minimum value. More... | |
| void | setBarStyle (BarStyle style) |
| Sets visual style of the widget. More... | |
| BarStyle | barStyle () const |
| Returns current progree bar style. More... | |
| void | setOutlinePenWidth (double penWidth) |
| Sets width of the outline circle pen. More... | |
| double | outlinePenWidth () const |
| Returns width of the outline circle pen. More... | |
| void | setDataPenWidth (double penWidth) |
| Sets width of the data circle pen. More... | |
| double | dataPenWidth () const |
| Returns width of the data circle pen. More... | |
| void | setDataColors (const QGradientStops &stopPoints) |
| Sets colors of the visible data and makes gradient brush from them. Gradient colors can be set for Donut and Pie styles (see setBarStyle() function). More... | |
| void | setFormat (const QString &format) |
| Defines the string used to generate the current text. If no format is set, no text will be shown. More... | |
| void | resetFormat () |
| Sets format string to empty string. No text will be shown therefore. See setFormat() for more information. More... | |
| QString | format () const |
| Returns the string used to generate the current text. More... | |
| void | setDecimals (int count) |
| Sets number of decimals to show after the comma (default is 1). More... | |
| int | decimals () const |
| Returns number of decimals to show after the comma (default is 1). More... | |
| double | value () const |
| Returns current value shown on the widget. More... | |
| double | minimum () const |
| Returns minimum of the allowed value range. More... | |
| double | maximum () const |
| Returns maximum of the allowed value range. More... | |
Static Public Attributes | |
| static const int | PositionLeft = 180 |
| static const int | PositionTop = 90 |
| static const int | PositionRight = 0 |
| static const int | PositionBottom = -90 |
Protected Member Functions | |
| virtual void | paintEvent (QPaintEvent *event) |
| virtual void | drawBackground (QPainter &p, const QRectF &baseRect) |
| virtual void | drawBase (QPainter &p, const QRectF &baseRect) |
| virtual void | drawValue (QPainter &p, const QRectF &baseRect, double value, double arcLength) |
| virtual void | calculateInnerRect (const QRectF &baseRect, double outerRadius, QRectF &innerRect, double &innerRadius) |
| virtual void | drawInnerBackground (QPainter &p, const QRectF &innerRect) |
| virtual void | drawText (QPainter &p, const QRectF &innerRect, double innerRadius, double value) |
| virtual QString | valueToText (double value) const |
| virtual void | valueFormatChanged () |
| virtual QSize | minimumSizeHint () const |
| virtual bool | hasHeightForWidth () const |
| virtual int | heightForWidth (int w) const |
| void | rebuildDataBrushIfNeeded () |
Protected Attributes | |
| double | m_min |
| double | m_max |
| double | m_value |
| double | m_nullPosition |
| BarStyle | m_barStyle |
| double | m_outlinePenWidth |
| double | m_dataPenWidth |
| QGradientStops | m_gradientData |
| bool | m_rebuildBrush |
| QString | m_format |
| int | m_decimals |
| int | m_updateFlags |
Static Protected Attributes | |
| static const int | UF_VALUE = 1 |
| static const int | UF_PERCENT = 2 |
| static const int | UF_MAX = 4 |
The QRoundProgressBar class represents a circular progress bar and maintains its API similar to the QProgressBar.
QRoundProgressBar currently supports Donut, Pie and Line styles. See setBarStyle() for more details.
Generally QRoundProgressBar uses its palette and font attributes to define how it will look.
The following QPalette members are considered:
Create a QPalette with given attributes and apply it via setPalette().
Donut and Pie styles allow to use color gradient for currernt value area instead of plain brush fill. See setDataColors() for more details.
Value text is generally drawn inside the QRoundProgressBar using its font() and QPalette::Text role from its palette().
To define pattern of the text, use setFormat() function (see Qt's QProgressBar for more details).
To define number of decimals to be shown, use setDecimals() function.
To use own font for value text, apply it via setFont().
By default, font size will be adjusted automatically to fit the inner circle of the widget.
Definition at line 59 of file QRoundProgressBar.h.
The BarStyle enum defines general look of the progress bar.
| Enumerator | |
|---|---|
| StyleDonut | Donut style (filled torus around the text) |
| StylePie | Pie style (filled pie segment with the text in center) |
| StyleLine | Line style (thin round line around the text) |
Definition at line 84 of file QRoundProgressBar.h.
|
explicit |
Definition at line 13 of file QRoundProgressBar.cpp.
|
inline |
Returns current progree bar style.
Definition at line 101 of file QRoundProgressBar.h.
|
protectedvirtual |
Definition at line 231 of file QRoundProgressBar.cpp.
References m_barStyle, m_outlinePenWidth, and StyleLine.
Referenced by paintEvent().
|
inline |
Returns width of the data circle pen.
Definition at line 121 of file QRoundProgressBar.h.
|
inline |
Returns number of decimals to show after the comma (default is 1).
Definition at line 165 of file QRoundProgressBar.h.
|
protectedvirtual |
Definition at line 168 of file QRoundProgressBar.cpp.
Referenced by paintEvent().
|
protectedvirtual |
Definition at line 173 of file QRoundProgressBar.cpp.
References color, m_barStyle, m_outlinePenWidth, StyleDonut, StyleLine, and StylePie.
Referenced by paintEvent().
|
protectedvirtual |
Definition at line 247 of file QRoundProgressBar.cpp.
References m_barStyle, and StyleDonut.
Referenced by paintEvent().
|
protectedvirtual |
Definition at line 255 of file QRoundProgressBar.cpp.
References color, m_decimals, m_format, value(), and valueToText().
Referenced by paintEvent().
|
protectedvirtual |
Definition at line 199 of file QRoundProgressBar.cpp.
References color, m_barStyle, m_dataPenWidth, m_min, m_nullPosition, m_outlinePenWidth, StyleLine, and value().
Referenced by paintEvent().
|
inline |
Returns the string used to generate the current text.
Definition at line 154 of file QRoundProgressBar.h.
Referenced by setFormat().
|
inlineprotectedvirtual |
Definition at line 241 of file QRoundProgressBar.h.
|
inlineprotectedvirtual |
Definition at line 242 of file QRoundProgressBar.h.
|
inline |
Returns maximum of the allowed value range.
Definition at line 181 of file QRoundProgressBar.h.
|
inline |
Returns minimum of the allowed value range.
Definition at line 176 of file QRoundProgressBar.h.
|
inlineprotectedvirtual |
Definition at line 239 of file QRoundProgressBar.h.
|
inline |
Return position (in degrees) of minimum value.
Definition at line 73 of file QRoundProgressBar.h.
|
inline |
Returns width of the outline circle pen.
Definition at line 111 of file QRoundProgressBar.h.
|
protectedvirtual |
Definition at line 127 of file QRoundProgressBar.cpp.
References calculateInnerRect(), drawBackground(), drawBase(), drawInnerBackground(), drawText(), drawValue(), height, m_max, m_min, m_value, rebuildDataBrushIfNeeded(), and width.
|
protected |
Definition at line 302 of file QRoundProgressBar.cpp.
References m_gradientData, m_nullPosition, and m_rebuildBrush.
Referenced by paintEvent().
| void QRoundProgressBar::resetFormat | ( | ) |
Sets format string to empty string. No text will be shown therefore. See setFormat() for more information.
Definition at line 113 of file QRoundProgressBar.cpp.
References m_format, and valueFormatChanged().
| void QRoundProgressBar::setBarStyle | ( | QRoundProgressBar::BarStyle | style | ) |
Sets visual style of the widget.
Definition at line 72 of file QRoundProgressBar.cpp.
References m_barStyle.
| void QRoundProgressBar::setDataColors | ( | const QGradientStops & | stopPoints | ) |
Sets colors of the visible data and makes gradient brush from them. Gradient colors can be set for Donut and Pie styles (see setBarStyle() function).
Warning: this function will override widget's palette() to set dynamically created gradient brush.
| stopPoints | List of colors (should have at least 2 values, see Qt's QGradientStops for more details). Color value at point 0 corresponds to the minimum() value, while color value at point 1 corresponds to the maximum(). Other colors will be distributed accordingly to the defined ranges (see setRange()). |
Definition at line 96 of file QRoundProgressBar.cpp.
References m_gradientData, and m_rebuildBrush.
| void QRoundProgressBar::setDataPenWidth | ( | double | penWidth | ) |
Sets width of the data circle pen.
| penWidth | width of the data circle pen (in pixels) |
Definition at line 88 of file QRoundProgressBar.cpp.
References m_dataPenWidth.
| void QRoundProgressBar::setDecimals | ( | int | count | ) |
Sets number of decimals to show after the comma (default is 1).
Definition at line 119 of file QRoundProgressBar.cpp.
References count, m_decimals, and valueFormatChanged().
| void QRoundProgressBar::setFormat | ( | const QString & | format | ) |
Defines the string used to generate the current text. If no format is set, no text will be shown.
| format | see QProgressBar's format description |
Definition at line 105 of file QRoundProgressBar.cpp.
References format(), m_format, and valueFormatChanged().
|
slot |
Defines maximum of the allowed value range. If the current value does not fit into the range, it will be automatically adjusted.
| max | maximum of the allowed value range |
Definition at line 45 of file QRoundProgressBar.cpp.
References m_min, and setRange().
|
slot |
Defines minimum of the allowed value range. If the current value does not fit into the range, it will be automatically adjusted.
| min | minimum of the allowed value range |
Definition at line 43 of file QRoundProgressBar.cpp.
References m_max, and setRange().
| void QRoundProgressBar::setNullPosition | ( | double | position | ) |
Defines position of minimum value.
| position | position on the circle (in degrees) of minimum value |
Definition at line 62 of file QRoundProgressBar.cpp.
References m_gradientData, m_nullPosition, m_rebuildBrush, and position.
| void QRoundProgressBar::setOutlinePenWidth | ( | double | penWidth | ) |
Sets width of the outline circle pen.
| penWidth | width of the outline circle pen (in pixels) |
Definition at line 80 of file QRoundProgressBar.cpp.
References m_outlinePenWidth.
|
slot |
Defines minimum und maximum of the allowed value range. If the current value does not fit into the range, it will be automatically adjusted.
| min | minimum of the allowed value range |
| max | maximum of the allowed value range |
Definition at line 27 of file QRoundProgressBar.cpp.
References m_gradientData, m_max, m_min, m_rebuildBrush, and m_value.
Referenced by setMaximum(), and setMinimum().
|
slot |
Sets a value which will be shown on the widget.
Definition at line 47 of file QRoundProgressBar.cpp.
References m_max, m_min, and m_value.
Referenced by setValue().
|
slot |
Integer version of the previous slot.
Definition at line 60 of file QRoundProgressBar.cpp.
References setValue().
|
inline |
Returns current value shown on the widget.
Definition at line 171 of file QRoundProgressBar.h.
Referenced by drawText(), drawValue(), and valueToText().
|
protectedvirtual |
Definition at line 290 of file QRoundProgressBar.cpp.
References m_format, m_updateFlags, UF_MAX, UF_PERCENT, and UF_VALUE.
Referenced by resetFormat(), setDecimals(), and setFormat().
|
protectedvirtual |
Definition at line 272 of file QRoundProgressBar.cpp.
References m_decimals, m_format, m_max, m_min, m_updateFlags, UF_MAX, UF_PERCENT, UF_VALUE, and value().
Referenced by drawText().
|
protected |
Definition at line 250 of file QRoundProgressBar.h.
Referenced by calculateInnerRect(), drawBase(), drawInnerBackground(), drawValue(), and setBarStyle().
|
protected |
Definition at line 251 of file QRoundProgressBar.h.
Referenced by drawValue(), and setDataPenWidth().
|
protected |
Definition at line 257 of file QRoundProgressBar.h.
Referenced by drawText(), setDecimals(), and valueToText().
|
protected |
Definition at line 256 of file QRoundProgressBar.h.
Referenced by drawText(), resetFormat(), setFormat(), valueFormatChanged(), and valueToText().
|
protected |
Definition at line 253 of file QRoundProgressBar.h.
Referenced by rebuildDataBrushIfNeeded(), setDataColors(), setNullPosition(), and setRange().
|
protected |
Definition at line 246 of file QRoundProgressBar.h.
Referenced by paintEvent(), setMinimum(), setRange(), setValue(), and valueToText().
|
protected |
Definition at line 246 of file QRoundProgressBar.h.
Referenced by drawValue(), paintEvent(), setMaximum(), setRange(), setValue(), and valueToText().
|
protected |
Definition at line 249 of file QRoundProgressBar.h.
Referenced by drawValue(), rebuildDataBrushIfNeeded(), and setNullPosition().
|
protected |
Definition at line 251 of file QRoundProgressBar.h.
Referenced by calculateInnerRect(), drawBase(), drawValue(), and setOutlinePenWidth().
|
protected |
Definition at line 254 of file QRoundProgressBar.h.
Referenced by rebuildDataBrushIfNeeded(), setDataColors(), setNullPosition(), and setRange().
|
protected |
Definition at line 262 of file QRoundProgressBar.h.
Referenced by valueFormatChanged(), and valueToText().
|
protected |
Definition at line 247 of file QRoundProgressBar.h.
Referenced by paintEvent(), setRange(), and setValue().
|
static |
Definition at line 67 of file QRoundProgressBar.h.
|
static |
Definition at line 64 of file QRoundProgressBar.h.
|
static |
Definition at line 66 of file QRoundProgressBar.h.
|
static |
Definition at line 65 of file QRoundProgressBar.h.
|
staticprotected |
Definition at line 261 of file QRoundProgressBar.h.
Referenced by valueFormatChanged(), and valueToText().
|
staticprotected |
Definition at line 260 of file QRoundProgressBar.h.
Referenced by valueFormatChanged(), and valueToText().
|
staticprotected |
Definition at line 259 of file QRoundProgressBar.h.
Referenced by valueFormatChanged(), and valueToText().