![]() |
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.
|
explicit |
|
inline |
Returns current progree bar style.
|
protectedvirtual |
References m_barStyle, m_outlinePenWidth, and StyleLine.
Referenced by paintEvent().
|
inline |
Returns width of the data circle pen.
|
inline |
Returns number of decimals to show after the comma (default is 1).
|
protectedvirtual |
Referenced by paintEvent().
|
protectedvirtual |
References color, m_barStyle, m_outlinePenWidth, StyleDonut, StyleLine, and StylePie.
Referenced by paintEvent().
|
protectedvirtual |
References m_barStyle, and StyleDonut.
Referenced by paintEvent().
|
protectedvirtual |
References color, m_decimals, m_format, value(), and valueToText().
Referenced by paintEvent().
|
protectedvirtual |
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.
Referenced by setFormat().
|
inlineprotectedvirtual |
|
inlineprotectedvirtual |
|
inline |
Returns maximum of the allowed value range.
|
inline |
Returns minimum of the allowed value range.
|
inlineprotectedvirtual |
|
inline |
Return position (in degrees) of minimum value.
|
inline |
Returns width of the outline circle pen.
|
protectedvirtual |
References calculateInnerRect(), drawBackground(), drawBase(), drawInnerBackground(), drawText(), drawValue(), height, m_max, m_min, m_value, rebuildDataBrushIfNeeded(), and width.
|
protected |
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.
References m_format, and valueFormatChanged().
| void QRoundProgressBar::setBarStyle | ( | QRoundProgressBar::BarStyle | style | ) |
| 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()). |
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) |
References m_dataPenWidth.
| void QRoundProgressBar::setDecimals | ( | int | count | ) |
Sets number of decimals to show after the comma (default is 1).
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 |
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 |
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 |
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 |
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) |
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 |
References m_gradientData, m_max, m_min, m_rebuildBrush, and m_value.
Referenced by setMaximum(), and setMinimum().
|
slot |
|
slot |
Integer version of the previous slot.
References setValue().
|
inline |
Returns current value shown on the widget.
Referenced by drawText(), drawValue(), and valueToText().
|
protectedvirtual |
References m_format, m_updateFlags, UF_MAX, UF_PERCENT, and UF_VALUE.
Referenced by resetFormat(), setDecimals(), and setFormat().
|
protectedvirtual |
References m_decimals, m_format, m_max, m_min, m_updateFlags, UF_MAX, UF_PERCENT, UF_VALUE, and value().
Referenced by drawText().
|
protected |
Referenced by calculateInnerRect(), drawBase(), drawInnerBackground(), drawValue(), and setBarStyle().
|
protected |
Referenced by drawValue(), and setDataPenWidth().
|
protected |
Referenced by drawText(), setDecimals(), and valueToText().
|
protected |
Referenced by drawText(), resetFormat(), setFormat(), valueFormatChanged(), and valueToText().
|
protected |
Referenced by rebuildDataBrushIfNeeded(), setDataColors(), setNullPosition(), and setRange().
|
protected |
Referenced by paintEvent(), setMinimum(), setRange(), setValue(), and valueToText().
|
protected |
Referenced by drawValue(), paintEvent(), setMaximum(), setRange(), setValue(), and valueToText().
|
protected |
Referenced by drawValue(), rebuildDataBrushIfNeeded(), and setNullPosition().
|
protected |
Referenced by calculateInnerRect(), drawBase(), drawValue(), and setOutlinePenWidth().
|
protected |
Referenced by rebuildDataBrushIfNeeded(), setDataColors(), setNullPosition(), and setRange().
|
protected |
Referenced by valueFormatChanged(), and valueToText().
|
protected |
Referenced by paintEvent(), setRange(), and setValue().
|
static |
|
static |
|
static |
|
static |
|
staticprotected |
Referenced by valueFormatChanged(), and valueToText().
|
staticprotected |
Referenced by valueFormatChanged(), and valueToText().
|
staticprotected |
Referenced by valueFormatChanged(), and valueToText().