Skip to main content

QCustomAvatar

QCustomAvatar

A single circular avatar with an optional status dot.

Shows either initials (text) or an image, clipped to a circle, over a solid fill. An optional status / notification dot sits in a corner with a ring that separates it from whatever is behind the avatar (set statusBorderColor to the surface colour). An optional outer ring frames the whole avatar. Everything is painted with QPainter so it stays crisp at any size and needs no children. Emits clicked so it can act as a profile button.

(QCustomAvatarGroup already exists for a row of overlapping avatars; this is the single, status-aware building block.)

At a glance

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

Quick start

from Custom_Widgets.QCustomAvatar import QCustomAvatar

widget = QCustomAvatar()

Dark theme

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

QCustomAvatar in dark theme

Properties

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

PropertyTypeDefault
textstringM
imageSourcestring
cornerRadiusint-1
bgColorcolor#3355e8
textColorcolor#ffffff
showStatusboolTrue
statusColorcolor#f2704e
statusPositionenum: top-right/bottom-right/top-left/bottom-left``top-right
statusBorderColorcolor#ffffff
ringColorcolor#00000000
ringWidthint0

Signals

Signal
clicked()

Methods

MethodDescription
bgColor(*args, **kwargs)Bg color.
clicked(...)Clicked.
cornerRadius(*args, **kwargs)Corner radius.
imageSource(*args, **kwargs)Image source.
ringColor(*args, **kwargs)Ring color.
ringWidth(*args, **kwargs)Ring width.
setBgColor(c)Set the bg color.
setImage(image)Set the image.
setImageSource(source)Set the avatar image from a local PATH or an http(s) URL — the URL is
setStatus(visible, color=None)Set the status.
setText(text)Set the text.
showStatus(*args, **kwargs)Show the status.
statusBorderColor(*args, **kwargs)Status border color.
statusColor(*args, **kwargs)Status color.
statusPosition(*args, **kwargs)Status position.
text(*args, **kwargs)Text.
textColor(*args, **kwargs)Text color.

Theming

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

See Design tokens.

AnalogGaugeWidget · QCustomAgendaList · QCustomAlert · QCustomAvatarGroup · QCustomBadge · QCustomCard · QCustomChip · QCustomClockLabel