10 #include <QtGui/QPainter>
11 #include <QtGui/QPainterPath>
18 m_nullPosition(PositionTop),
19 m_barStyle(StyleDonut),
22 m_rebuildBrush(false),
25 m_updateFlags(UF_PERCENT) {}
129 QRectF baseRect(1, 1, outerRadius - 2, outerRadius - 2);
131 QImage buffer(outerRadius, outerRadius,
132 QImage::Format_ARGB32_Premultiplied);
135 p.setRenderHint(QPainter::Antialiasing);
151 double innerRadius(0);
162 QPainter painter(
this);
164 painter.fillRect(baseRect, palette().window());
165 painter.drawImage(0, 0, buffer);
170 p.fillRect(baseRect, palette().window());
177 p.setBrush(palette().base());
178 p.drawEllipse(baseRect);
183 p.setBrush(palette().base());
184 p.drawEllipse(baseRect);
189 p.setBrush(Qt::NoBrush);
190 p.drawEllipse(baseRect.adjusted(
200 const QRectF &baseRect,
209 p.setBrush(Qt::NoBrush);
210 p.drawArc(baseRect.adjusted(
218 QPainterPath dataPath;
219 dataPath.setFillRule(Qt::WindingFill);
222 dataPath.moveTo(baseRect.center());
224 dataPath.lineTo(baseRect.center());
226 p.setBrush(palette().highlight());
228 p.drawPath(dataPath);
234 double &innerRadius) {
240 innerRadius = outerRadius * 0.75;
243 double delta = (outerRadius - innerRadius) / 2;
244 innerRect = QRectF(delta, delta, innerRadius, innerRadius);
248 const QRectF &innerRect) {
250 p.setBrush(palette().alternateBase());
251 p.drawEllipse(innerRect);
256 const QRectF &innerRect,
263 f.setPixelSize(innerRadius *
264 qMax(0.05, (0.35 - (
double)
m_decimals * 0.08)));
267 QRectF textRect(innerRect);
268 p.setPen(palette().text().
color());
280 textToDraw.replace(
"%p", QString::number(procent,
'f',
m_decimals));
284 textToDraw.replace(
"%m",
306 QConicalGradient dataBrush;
307 dataBrush.setCenter(0.5, 0.5);
308 dataBrush.setCoordinateMode(QGradient::StretchToDeviceMode);
319 QPalette p(palette());
320 p.setBrush(QPalette::Highlight, dataBrush);
filament::Texture::InternalFormat format
void setDataPenWidth(double penWidth)
Sets width of the data circle pen.
void setValue(double val)
Sets a value which will be shown on the widget.
virtual void calculateInnerRect(const QRectF &baseRect, double outerRadius, QRectF &innerRect, double &innerRadius)
void setMinimum(double min)
Defines minimum of the allowed value range. If the current value does not fit into the range,...
virtual void drawText(QPainter &p, const QRectF &innerRect, double innerRadius, double value)
void setOutlinePenWidth(double penWidth)
Sets width of the outline circle pen.
virtual void drawBackground(QPainter &p, const QRectF &baseRect)
void setDecimals(int count)
Sets number of decimals to show after the comma (default is 1).
double value() const
Returns current value shown on the widget.
void setMaximum(double max)
Defines maximum of the allowed value range. If the current value does not fit into the range,...
virtual void drawValue(QPainter &p, const QRectF &baseRect, double value, double arcLength)
QRoundProgressBar(QWidget *parent=0)
virtual void drawBase(QPainter &p, const QRectF &baseRect)
void setBarStyle(BarStyle style)
Sets visual style of the widget.
void setFormat(const QString &format)
Defines the string used to generate the current text. If no format is set, no text will be shown.
static const int UF_VALUE
virtual void valueFormatChanged()
virtual void paintEvent(QPaintEvent *event)
virtual void drawInnerBackground(QPainter &p, const QRectF &innerRect)
void rebuildDataBrushIfNeeded()
virtual QString valueToText(double value) const
void setNullPosition(double position)
Defines position of minimum value.
static const int UF_PERCENT
QGradientStops m_gradientData
QString format() const
Returns the string used to generate the current text.
void setRange(double min, double max)
Defines minimum und maximum of the allowed value range. If the current value does not fit into the ra...
BarStyle
The BarStyle enum defines general look of the progress bar.
@ StylePie
Pie style (filled pie segment with the text in center)
@ StyleLine
Line style (thin round line around the text)
@ StyleDonut
Donut style (filled torus around the text)
void resetFormat()
Sets format string to empty string. No text will be shown therefore. See setFormat() for more informa...
void setDataColors(const QGradientStops &stopPoints)
Sets colors of the visible data and makes gradient brush from them. Gradient colors can be set for Do...