From 817404e3962da1b29581e13b47dfc199f7ac8071 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Sun, 30 Jun 2024 17:56:10 +0200 Subject: [PATCH] QPA/Windows: Avoid confusing warning about empty QPixmap A drag'n'drop operation on a screen with a dpr != 1 tries to scale the (optional) QDrag pixmap. This results in a confusing warning "QPixmap::scaleWidth: Pixmap is a null pixmap". Avoid it by checking if there is a pixmap available before trying to scale it. Fixes: QTBUG-122755 Pick-to: 6.5 Change-Id: I554675b79840e34ddd3f53153b68e913fd333122 Reviewed-by: Oliver Wolff (cherry picked from commit db328ca975bc63f3baf3d021dcff1ea37fa6b6a0) Reviewed-by: Qt Cherry-pick Bot --- src/plugins/platforms/windows/qwindowsdrag.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/windows/qwindowsdrag.cpp b/src/plugins/platforms/windows/qwindowsdrag.cpp index b872ef2ad69..c9e7ae90a9e 100644 --- a/src/plugins/platforms/windows/qwindowsdrag.cpp +++ b/src/plugins/platforms/windows/qwindowsdrag.cpp @@ -272,7 +272,7 @@ void QWindowsOleDropSource::createCursors() hotSpotScaleFactor = QHighDpiScaling::factor(platformScreen); pixmapScaleFactor = hotSpotScaleFactor / pixmap.devicePixelRatio(); } - QPixmap scaledPixmap = qFuzzyCompare(pixmapScaleFactor, 1.0) + QPixmap scaledPixmap = (hasPixmap && qFuzzyCompare(pixmapScaleFactor, 1.0)) ? pixmap : pixmap.scaled((QSizeF(pixmap.size()) * pixmapScaleFactor).toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation);