Use devicePixelRatioF instead of devicePixelRatio when rendering pages

This commit is contained in:
Luis Ángel San Martín
2022-01-13 23:12:05 +01:00
parent c414761be7
commit e532fa4439

View File

@ -364,10 +364,10 @@ void Viewer::updateContentSize()
content->resize(pagefit); content->resize(pagefit);
// TODO: updtateContentSize should only scale the pixmap once // TODO: updtateContentSize should only scale the pixmap once
if (devicePixelRatio() > 1) // only in retina display if (devicePixelRatioF() > 1) // only in HDPI displays
{ {
QPixmap page = currentPage->scaled(content->width() * devicePixelRatio(), content->height() * devicePixelRatio(), Qt::KeepAspectRatio, Qt::SmoothTransformation); QPixmap page = currentPage->scaled(content->width() * devicePixelRatioF(), content->height() * devicePixelRatioF(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
page.setDevicePixelRatio(devicePixelRatio()); page.setDevicePixelRatio(devicePixelRatioF());
content->setPixmap(page); content->setPixmap(page);
} }
@ -1069,9 +1069,9 @@ void Viewer::mousePressEvent(QMouseEvent *event)
void Viewer::mouseReleaseEvent(QMouseEvent *event) void Viewer::mouseReleaseEvent(QMouseEvent *event)
{ {
if (event->button() == Qt::LeftButton) { if (event->button() == Qt::LeftButton) {
drag = false; drag = false;
setCursor(Qt::OpenHandCursor); setCursor(Qt::OpenHandCursor);
event->accept(); event->accept();
return; return;
} }