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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user