better device ratio support
This commit is contained in:
parent
9302439fcb
commit
65b328396c
|
@ -30,6 +30,7 @@
|
|||
#include "utils.h"
|
||||
#include "settings.h"
|
||||
#include "widgets/customdisablediconengine.h"
|
||||
#include <QApplication>
|
||||
|
||||
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<QPixmap>(width,height);
|
||||
qreal dpr=qApp->devicePixelRatio();
|
||||
PPixmap icon = std::make_shared<QPixmap>(width*dpr,height*dpr);
|
||||
icon->fill(Qt::transparent);
|
||||
QPainter painter(icon.get());
|
||||
renderer.render(&painter,icon->rect());
|
||||
icon->setDevicePixelRatio(dpr);
|
||||
return icon;
|
||||
}
|
||||
|
||||
|
|
|
@ -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()<<rcClip<<rcCaret<<cacheRC;
|
||||
painter.drawImage(rcCaret,*mContentImage,cacheRC);
|
||||
} else {
|
||||
QRect rcDraw;
|
||||
|
|
|
@ -76,6 +76,6 @@ void CustomDisabledIconEngine::setPixmap(const QPixmap &pixmap)
|
|||
}
|
||||
}
|
||||
mDisabledPixmap = QPixmap::fromImage(image);
|
||||
|
||||
mDisabledPixmap.setDevicePixelRatio(mPixmap.devicePixelRatioF());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue