|
QVISH 0.1
|
The QRoundProgressBar class represents a circular progress bar and maintains its API similar to the QProgressBar. More...
#include <QRoundProgressBar.hpp>
Public Types | |
| enum | BarStyle { StyleDonut , StylePie , StyleLine , StyleExpand } |
| The BarStyle enum defines general look of the progress bar. More... | |
Public Slots | |
| void | setDValue (double val) |
| Sets a value which will be shown on the widget. | |
| void | setMaximum (double max) |
| Defines maximum of the allowed value range. | |
| void | setMinimum (double min) |
| Defines minimum of the allowed value range. | |
| void | setRange (double min, double max) |
| Defines minimum und maximum of the allowed value range. | |
| void | setValue (int val) |
| Integer version of the previous slot. | |
Public Member Functions | |
| BarStyle | barStyle () const |
| Returns current progree bar style. | |
| double | dataPenWidth () const |
| Returns width of the data circle pen. | |
| int | decimals () const |
| Returns number of decimals to show after the comma (default is 1). | |
| QString | format () const |
| Returns the string used to generate the current text. | |
| double | maximum () const |
| Returns maximum of the allowed value range. | |
| double | minimum () const |
| Returns minimum of the allowed value range. | |
| double | nullPosition () const |
| Return position (in degrees) of minimum value. | |
| double | outlinePenWidth () const |
| Returns width of the outline circle pen. | |
| QRoundProgressBar (QWidget *parent=0) | |
| void | resetFormat () |
| Sets format string to empty string. | |
| void | setBarStyle (BarStyle style) |
| Sets visual style of the widget. | |
| void | setDataColors (const QGradientStops &stopPoints) |
| Sets colors of the visible data and makes gradient brush from them. | |
| void | setDataPenWidth (double penWidth) |
| Sets width of the data circle pen. | |
| void | setDecimals (int count) |
| Sets number of decimals to show after the comma (default is 1). | |
| void | setFormat (const QString &format) |
| Defines the string used to generate the current text. | |
| void | setNullPosition (double position) |
| Defines position of minimum value. | |
| void | setOutlinePenWidth (double penWidth) |
| Sets width of the outline circle pen. | |
| double | value () const |
| Returns current value shown on the widget. | |
Static Public Attributes | |
| static const int | PositionBottom = -90 |
| static const int | PositionLeft = 180 |
| static const int | PositionRight = 0 |
| static const int | PositionTop = 90 |
Protected Member Functions | |
| virtual void | calculateInnerRect (const QRectF &baseRect, double outerRadius, QRectF &innerRect, double &innerRadius) |
| virtual void | drawBackground (QPainter &p, const QRectF &baseRect) |
| virtual void | drawBase (QPainter &p, const QRectF &baseRect) |
| virtual void | drawInnerBackground (QPainter &p, const QRectF &innerRect) |
| virtual void | drawText (QPainter &p, const QRectF &innerRect, double innerRadius, double value) |
| virtual void | drawValue (QPainter &p, const QRectF &baseRect, double value, double delta) |
| bool | hasHeightForWidth () const override |
| int | heightForWidth (int w) const override |
| QSize | minimumSizeHint () const override |
| virtual void | paintEvent (QPaintEvent *event) |
| void | rebuildDataBrushIfNeeded () |
| QSize | sizeHint () const override |
| virtual void | valueFormatChanged () |
| virtual QString | valueToText (double value) const |
Protected Attributes | |
| BarStyle | m_barStyle |
| double | m_dataPenWidth |
| int | m_decimals |
| QString | m_format |
| QGradientStops | m_gradientData |
| double | m_max |
| double | m_min |
| double | m_nullPosition |
| double | m_outlinePenWidth |
| bool | m_rebuildBrush |
| int | m_updateFlags |
| double | m_value |
Static Protected Attributes | |
| static const int | UF_MAX = 4 |
| static const int | UF_PERCENT = 2 |
| static const int | UF_VALUE = 1 |
The QRoundProgressBar class represents a circular progress bar and maintains its API similar to the QProgressBar.
QRoundProgressBar currently supports Donut, Pie, Expand 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, Expand 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.
The BarStyle enum defines general look of the progress bar.
|
inline |
Returns current progree bar style.
|
inline |
Returns number of decimals to show after the comma (default is 1).
|
inline |
Returns maximum of the allowed value range.
|
inline |
Returns minimum of the allowed value range.
|
inline |
Return position (in degrees) of minimum value.
| void QRoundProgressBar::resetFormat | ( | ) |
Sets format string to empty string.
No text will be shown therefore. See setFormat() for more information.
| void QRoundProgressBar::setBarStyle | ( | QRoundProgressBar::BarStyle | style | ) |
Sets visual style of the widget.
| 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()). |
| void QRoundProgressBar::setDataPenWidth | ( | double | penWidth | ) |
Sets width of the data circle pen.
| penWidth | width of the data circle pen (in pixels) |
| void QRoundProgressBar::setDecimals | ( | int | count | ) |
Sets number of decimals to show after the comma (default is 1).
|
slot |
Sets a value which will be shown on the widget.
Referenced by setValue().
| 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().
|
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 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 setRange().
| void QRoundProgressBar::setNullPosition | ( | double | position | ) |
Defines position of minimum value.
| position | position on the circle (in degrees) of minimum value |
| void QRoundProgressBar::setOutlinePenWidth | ( | double | penWidth | ) |
Sets width of the outline circle pen.
| penWidth | width of the outline circle pen (in pixels) |
|
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 |
Referenced by setMaximum(), and setMinimum().
|
slot |
Integer version of the previous slot.
References setDValue().
|
inline |
Returns current value shown on the widget.