Skip to main content

QCustomRulerPicker

QCustomRulerPicker

A numbered tick-ruler value selector.

A measurement-style ruler (the weight / height "55 … 65 … 90" picker): a strip of minor ticks with taller MAJOR ticks + numeric labels, and an indicator at the current value. Drag or scroll to change the value; it snaps to step.

Two looks (centered): False (default) - a FIXED ruler: min..max mapped across the width, the indicator slides to the value (matches the reference weight card). True - a SCROLLING ruler: the value is pinned under a fixed centre indicator and the scale scrolls (an iOS-style picker).

Horizontal or vertical (orientation). Painted with QPainter; the strip FLEXes to the widget, and an optional big value + unit readout sits above. Colours are qproperties so they flip with the theme. Signal: valueChanged(float).

At a glance

TierFree (GPLv3)
Importfrom Custom_Widgets.QCustomRulerPicker import QCustomRulerPicker
Qt DesignerYes — drag it from the palette

Quick start

from Custom_Widgets.QCustomRulerPicker import QCustomRulerPicker

widget = QCustomRulerPicker()
widget.setRange(40.0, 120.0)
widget.setUnit("kg")
widget.setValue(72.5) # clamps to the range, so set it after

That is the exact code behind the screenshot above.

Dark theme

Colours come from the design tokens, so the widget follows the app theme with no extra work.

QCustomRulerPicker in dark theme

Properties

Every property below is settable in code and in Qt Designer.

PropertyTypeDefault
valuefloat65.0
orientationenum: horizontal/vertical``horizontal
minimumfloat40.0
maximumfloat120.0
stepfloat1.0
majorEveryint5
centeredboolFalse
tickSpacingfloat9.0
snapboolTrue
unitstringKg
showValueboolFalse
tickColorcolor#4a4f5e
majorTickColorcolor#8b90a0
indicatorColorcolor#f4f6fb
labelColorcolor#8b90a0
valueColorcolor#f4f6fb

Signals

Signal
valueChanged(double)

Methods

MethodDescription
centered(*args, **kwargs)Centered.
indicatorColor(*args, **kwargs)Indicator color.
labelColor(*args, **kwargs)Label color.
majorEvery(*args, **kwargs)Major every.
majorTickColor(*args, **kwargs)Major tick color.
maximum(*args, **kwargs)Maximum.
minimum(*args, **kwargs)Minimum.
orientation(*args, **kwargs)Orientation.
setRange(minimum, maximum)Set the range.
setUnit(unit)Set the unit.
setValue(value)Set the value.
showValue(*args, **kwargs)Show the value.
snap(*args, **kwargs)Snap.
step(*args, **kwargs)Step.
tickColor(*args, **kwargs)Tick color.
tickSpacing(*args, **kwargs)Tick spacing.
unit(*args, **kwargs)Unit.
value(*args, **kwargs)Value.
valueChanged(...)Value changed.
valueColor(*args, **kwargs)Value color.

Theming

Colours come from the design tokens, so they follow the active theme. Roles used: accent.

See Design tokens.

QCustomButtonGroup · QCustomCheckBox · QCustomColorPicker · QCustomComboBox · QCustomDateEdit · QCustomDateRangePicker · QCustomEmojiPicker · QCustomFileDropZone