summaryrefslogtreecommitdiffstats
path: root/examples/corelib
diff options
context:
space:
mode:
authorMorten Sørvig <morten.sorvig@qt.io>2021-08-16 08:41:57 +0200
committerMorten Sørvig <morten.sorvig@qt.io>2021-09-01 15:24:05 +0200
commit81a7344e1dea562271865ddf94a7d7138e663ce4 (patch)
tree3289768b62776ec2d93619043253955aad169843 /examples/corelib
parent4e460aa3f7fb5aa2f66a2a75b0aea82464ee5639 (diff)
Port to QImage and QPixmap deviceIndependentSize()
Replace the “size() / devicePixelRatio()” pattern with a call to deviceIndependentSize(). Change-Id: I9d9359e80b9e6643e7395028cd43e3261d449ae7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'examples/corelib')
-rw-r--r--examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
index bb1f83482b..a1431db0d3 100644
--- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
+++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp
@@ -109,7 +109,7 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */)
//! [7] //! [8]
auto previewPixmap = qFuzzyCompare(pixmap.devicePixelRatio(), qreal(1))
? pixmap
- : pixmap.scaled(pixmap.size() / pixmap.devicePixelRatio(), Qt::KeepAspectRatio,
+ : pixmap.scaled(pixmap.deviceIndependentSize().toSize(), Qt::KeepAspectRatio,
Qt::SmoothTransformation);
double scaleFactor = pixmapScale / curScale;
int newWidth = int(previewPixmap.width() * scaleFactor);
@@ -216,7 +216,7 @@ void MandelbrotWidget::mouseReleaseEvent(QMouseEvent *event)
pixmapOffset += event->position().toPoint() - lastDragPos;
lastDragPos = QPoint();
- const auto pixmapSize = pixmap.size() / pixmap.devicePixelRatio();
+ const auto pixmapSize = pixmap.deviceIndependentSize().toSize();
int deltaX = (width() - pixmapSize.width()) / 2 - pixmapOffset.x();
int deltaY = (height() - pixmapSize.height()) / 2 - pixmapOffset.y();
scroll(deltaX, deltaY);