- if (guiApp && guiApp->isInDarkMode()) {
- QImage img = bpixmap.toImage();
- img.invertPixels();
- bpixmap.convertFromImage(img);
+#if QT_VERSION >= 0x050000
+ // With Qt5, we render SVG directly for HiDPI scalability
+ FileName fname = imageLibFileSearch(imagedir, "search-options", "svgz,png");
+ QString fpath = toqstr(fname.absFileName());
+ if (!fpath.isEmpty()) {
+ QSvgRenderer svgRenderer(fpath);
+ if (svgRenderer.isValid()) {
+ pm = QPixmap(bpixmap.size() * dpr);
+ pm.fill(Qt::transparent);
+ QPainter painter(&pm);
+ svgRenderer.render(&painter);
+ pm.setDevicePixelRatio(dpr);
+ }