From 65b328396c2826a4e40572b3e9a1a7b7d4b9f108 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Sat, 2 Apr 2022 18:42:43 +0800 Subject: [PATCH] better device ratio support --- RedPandaIDE/iconsmanager.cpp | 5 ++++- RedPandaIDE/qsynedit/SynEdit.cpp | 1 - RedPandaIDE/widgets/customdisablediconengine.cpp | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/RedPandaIDE/iconsmanager.cpp b/RedPandaIDE/iconsmanager.cpp index b7eea624..c6d2f152 100644 --- a/RedPandaIDE/iconsmanager.cpp +++ b/RedPandaIDE/iconsmanager.cpp @@ -30,6 +30,7 @@ #include "utils.h" #include "settings.h" #include "widgets/customdisablediconengine.h" +#include IconsManager* pIconsManager; @@ -250,10 +251,12 @@ IconsManager::PPixmap IconsManager::createSVGIcon(const QString &filename, int w QSvgRenderer renderer(filename); if (!renderer.isValid()) return mDefaultIconPixmap; - PPixmap icon = std::make_shared(width,height); + qreal dpr=qApp->devicePixelRatio(); + PPixmap icon = std::make_shared(width*dpr,height*dpr); icon->fill(Qt::transparent); QPainter painter(icon.get()); renderer.render(&painter,icon->rect()); + icon->setDevicePixelRatio(dpr); return icon; } diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index d357afdd..55dac363 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -5978,7 +5978,6 @@ void SynEdit::paintEvent(QPaintEvent *event) cacheRC.setTop(rcClip.top()*dpr); cacheRC.setWidth(rcClip.width()*dpr); cacheRC.setHeight(rcClip.height()*dpr); - qDebug()<