Skip to main content

QCustomTrendChip

QCustomTrendChip

A directional delta / trend indicator.

A painted up/down/flat arrow that colour-codes a change (green up, red down, grey flat) with an optional value label. Three looks: variant="circle" (default) - just the arrow in a tinted circle (the classic income/expense chip); square, icon-only. variant="soft" - a rounded pill: tinted background + arrow + text. variant="plain" - arrow + text, no background. Direction is set explicitly or inferred from a numeric value's sign. The arrow is drawn with QPainter (no glyph font), so it is crisp and theme-tokenisable.

At a glance​

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

Quick start​

from Custom_Widgets.QCustomTrendChip import QCustomTrendChip

widget = QCustomTrendChip()
widget.setVariant("soft")
widget.setValue(12.4, "+12.4%")

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.

QCustomTrendChip in dark theme

Properties​

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

PropertyTypeDefault
textstring—
directionenum: up/down/flat``up
variantenum: circle/soft/plain``circle
upColorcolor#22c07e
downColorcolor#f2704e
flatColorcolor#8b909e
tintOpacityfloat0.14
cornerRadiusint15

Methods​

MethodDescription
cornerRadius(*args, **kwargs)Corner radius.
direction(*args, **kwargs)Direction.
downColor(*args, **kwargs)Down color.
flatColor(*args, **kwargs)Flat color.
setDirection(direction)Set the direction.
setText(text)Set the text.
setValue(value, text=None)Set direction from a number's sign; optionally format the label.
setVariant(variant)Set the variant.
text(*args, **kwargs)Text.
tintOpacity(*args, **kwargs)Tint opacity.
upColor(*args, **kwargs)Up color.
variant(*args, **kwargs)Variant.

QCustomAgendaList · QCustomAlert · QCustomAvatar · QCustomAvatarGroup · QCustomBadge · QCustomCard · QCustomChip · QCustomChipGroup