fix(gui): make SVG icon rasterization DPI-aware in loadPixmap (#189)

loadPixmap() rendered all SVGs at a hardcoded 64x64 pixels regardless of
display DPI. On HiDPI screens, Qt then downscaled these low-resolution
pixmaps to the toolbar icon size, producing chunky/aliased icons.

Multiply the render size by getMaximumDPR() and tag the resulting pixmap
with the correct devicePixelRatio, matching the pattern already used in
pixmapFromSvg(const char* name, QSizeF size). This ensures SVGs are
rasterized at the physical resolution needed for crisp display.
This commit is contained in:
forbes
2026-02-18 12:52:14 -06:00
parent 4510ace7b9
commit 99f2a92df4

View File

@@ -217,7 +217,9 @@ bool BitmapFactoryInst::loadPixmap(const QString& filename, QPixmap& icon) const
QFile svgFile(fi.filePath());
if (svgFile.open(QFile::ReadOnly | QFile::Text)) {
QByteArray content = svgFile.readAll();
icon = pixmapFromSvg(content, QSize(64, 64));
static qreal dpr = getMaximumDPR();
icon = pixmapFromSvg(content, QSize(64, 64) * dpr);
icon.setDevicePixelRatio(dpr);
}
}
else {