Skip to main content

QCustomProgressRing

QCustomProgressRing screenshot

QCustomProgressRing is a circular (determinate) progress indicator — a painted ring with a track arc and a progress arc that sweeps clockwise from 12 o'clock, plus an optional percentage in the centre. Unlike the indeterminate loaders, it shows a known value.


Overview

  • Determinate circular progress with an optional centre percentage.
  • Configurable min / max / value with clamping.
  • Tokenized ring / track / text colours and ring thickness.
  • Emits valueChanged(int).

Constructor

QCustomProgressRing(parent=None, minimum=0, maximum=100, value=0)

Properties

PropertyTypeDescription
minimum / maximumintValue range.
showTextboolShow the centre percentage (default True).
ringColor / trackColor / textColorQColorPainted colours (from tokens).
thicknessintRing stroke width in pixels.

The value is read/written through value() / setValue() (Qt-idiomatic), not a value property.

Methods

MethodDescription
value()Current value.
setValue(v)Set + clamp the value; emits valueChanged on change.
setRange(min, max)Set the range.
setMinimum(v) / setMaximum(v)Set a bound.
setShowText(on)Toggle the centre percentage.

Signals

SignalDescription
valueChanged(int)Emitted when the value changes.

Usage example

from qtpy.QtCore import QTimer
from qtpy.QtWidgets import QApplication
from Custom_Widgets.QCustomProgressRing import QCustomProgressRing
from Custom_Widgets.JSonStyles.tokens import DesignTokens, applyDesignTokens

app = QApplication([])
applyDesignTokens(app, tokens=DesignTokens(theme="light"))

ring = QCustomProgressRing(value=0)
ring.resize(120, 120)
ring.show()

# animate to 72%
timer = QTimer()
timer.timeout.connect(lambda: (ring.setValue(ring.value() + 1),
ring.value() >= 72 and timer.stop()))
timer.start(20)
app.exec()

Theming

Styled from the design tokens (progressring_qss) via applyDesignTokens; the ring/track/text colours use the accent / surface-muted / on-surface roles. See Theming.

API reference

Generated from the widget's live metaobject — do not edit by hand.

Properties

PropertyTypeDefault
minimumint0
maximumint100
showTextboolTrue
ringColorcolor
trackColorcolor
textColorcolor
thicknessint

Signals

Signal
valueChanged(int)

Methods

MethodDescription
maximum(*args, **kwargs)Maximum.
minimum(*args, **kwargs)Minimum.
ringColor(*args, **kwargs)Ring color.
setMaximum(m)Set the maximum.
setMinimum(m)Set the minimum.
setRange(minimum, maximum)Set the range.
setShowText(show)Set the show text.
setValue(value)Set the value.
showText(*args, **kwargs)Show the text.
textColor(*args, **kwargs)Text color.
thickness(*args, **kwargs)Thickness.
trackColor(*args, **kwargs)Track color.
value()Value.
valueChanged(...)Value changed.