Skip to main content

QCustomCompass

QCustomCompass

A heading / compass rose.

A painted compass: a tick ring with N / E / S / W (+ intercardinals), a two-tone needle and a centre readout (16-point cardinal + degrees). Set the heading (0-360°, 0 = North = up); it eases to the new bearing when animated.

Two looks (rotateBezel): False (default) - a FIXED rose, the needle rotates to the heading. True - a rotating COMPASS CARD: the needle stays up and the whole rose spins so the heading sits at the top (aircraft / marine style).

Interactive: drag around the centre to set the heading (opt-out via interactive=False). Painted with QPainter; it FLEXes to the widget and every colour is a qproperty so it flips with the theme. Signal: headingChanged(float).

At a glance​

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

Quick start​

from Custom_Widgets.QCustomCompass import QCustomCompass

widget = QCustomCompass()

Dark theme​

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

QCustomCompass in dark theme

Properties​

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

PropertyTypeDefault
headingfloat315.0
rotateBezelboolFalse
showIntercardinalsboolTrue
showReadoutboolTrue
animatedboolTrue
interactiveboolTrue
northColorcolor#e0463c
southColorcolor#cfd4de
ringColorcolor#2b3145
tickColorcolor#6b7280
cardinalColorcolor#f4f6fb
readoutColorcolor#f4f6fb
hubColorcolor#141826

Signals​

Signal
headingChanged(double)

Methods​

MethodDescription
animated(*args, **kwargs)Animated.
cardinal16(deg)Cardinal16.
cardinalColor(*args, **kwargs)Cardinal color.
heading(*args, **kwargs)Heading.
headingChanged(...)Heading changed.
hubColor(*args, **kwargs)Hub color.
interactive(*args, **kwargs)Interactive.
northColor(*args, **kwargs)North color.
readoutColor(*args, **kwargs)Readout color.
ringColor(*args, **kwargs)Ring color.
rotateBezel(*args, **kwargs)Rotate bezel.
setHeading(deg)Set the heading.
showIntercardinals(*args, **kwargs)Show the intercardinals.
showReadout(*args, **kwargs)Show the readout.
southColor(*args, **kwargs)South color.
tickColor(*args, **kwargs)Tick color.

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