![]() |
QRoundProgressBar
0.1.b
Qt circular progress bar widget
|
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 | |
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. | |
void | setDataPenWidth (double penWidth) |
Sets width of the data circle pen. More... | |
double | dataPenWidth () const |
Returns width of the data circle pen. | |
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. | |
QString | format () const |
Returns the string used to generate the current text. | |
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... | |
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.
|
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::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).
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 |
|
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 |
|
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 |
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 |
|
slot |
|
slot |
|
inline |
Returns current value shown on the widget.