Skip to main content

QCustomDotMatrix

Pro widget

QCustomDotMatrix ships in Custom Widgets Pro. The free package under GPLv3 does not include it.

See plans

QCustomDotMatrix

A density / category dot grid.

A grid of small dots where each cell carries a STATE (0..N). State 0 is the "empty" slot (drawn faintly with emptyColor); states 1..N pick a colour from colorsCsv. Use it for the dot-matrix density panels seen on modern dashboards (e.g. a "product" activity grid: valid / invalid / idle dots that thicken toward one corner). Painted (no QtCharts) so it is crisp at any size and needs no legend/toolbar.

Give the grid in code with setData([[0,1,2,...], ...]) (row-major 2-D list of state ints), or in Qt Designer with the dataCsv property (rows joined by ';', cells by ','). rows/cols size an empty grid. Colours are qproperties so a theme/manager can tokenise them and they flip on theme switch.

At a glance

TierPro
Importfrom Custom_Widgets.QCustomDotMatrix import QCustomDotMatrix
Qt DesignerYes — drag it from the palette

Quick start

from Custom_Widgets.QCustomDotMatrix import QCustomDotMatrix

widget = QCustomDotMatrix()

Dark theme

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

QCustomDotMatrix in dark theme

Properties

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

PropertyTypeDefault
dataCsvstring
rowsint6
colsint14
colorsCsvstring#8fe36b,#ffffff,#f6912b
emptyColorcolor#2c2c30
dotDiameterint0
gapRatiofloat0.55
emptyOpacityfloat0.6
squareboolFalse

Methods

MethodDescription
colorsCsv(*args, **kwargs)Colors csv.
cols(*args, **kwargs)Cols.
data()Data.
dataCsv(*args, **kwargs)Data csv.
dotDiameter(*args, **kwargs)Dot diameter.
emptyColor(*args, **kwargs)Empty color.
emptyOpacity(*args, **kwargs)Empty opacity.
gapRatio(*args, **kwargs)Gap ratio.
rows(*args, **kwargs)Rows.
setColors(colors)Set the colors.
setData(data)2-D row-major list of state ints (0 = empty, 1..N = colour index).
square(*args, **kwargs)Square.

Theming

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

See Design tokens.

QCustomAreaChart · QCustomBarChart · QCustomBeeswarm · QCustomBubbleChart · QCustomCandlestickChart · QCustomCompass · QCustomCompassDial · QCustomDivergingBarChart