Skip to content

icons.cpp

file src/app/theme/icons.cpp ยท Applications

The drawing code of the toolbar and menu icons and their rendering into pixmaps.

Source src/app/theme/icons.cpp

Namespaces

Namespace Description
nmeasim::app::theme The look of the desktop application: the Theme singleton with its night-bridge and daylight looks and the option to follow the desktop, and the code-painted icons.

Namespace members

Declared or defined in this file and documented on the page of their namespace.

Member Description
nmeasim::app::theme::make_icon Paints an icon in the given colours.
nmeasim::app::theme::themed_icon Paints an icon in the colours of the current theme.

Summary

File-local functions

Name Description
draw() Draws the outline and fills of one symbol.
render() Renders one symbol into a square pixmap.

File-local functions

draw()

void draw(QPainter& p, Icon icon, const QColor& color)

Draws the outline and fills of one symbol.

Coordinates are in a 24 by 24 unit design grid with the origin at the top left. Sets the painter's pen to a 1.8-unit round-capped stroke and changes its brush.

Parameters

Name Type Description
p QPainter& Painter already scaled so that 24 units span the target size.
icon Icon Symbol to draw.
color const QColor& Colour of strokes and fills.

Declared in src/app/theme/icons.cpp:32

render()

QPixmap render(Icon icon, const QColor& color, int size, double ratio)

Renders one symbol into a square pixmap.

Parameters

Name Type Description
icon Icon Symbol to draw.
color const QColor& Colour of strokes and fills.
size int Edge length in device-independent pixels, greater than 0.
ratio double Device pixel ratio: 1 for normal screens, 2 for HiDPI.

Returns QPixmap: A transparent pixmap of size times ratio physical pixels, rounded, with that device pixel ratio set.

Declared in src/app/theme/icons.cpp:171