From 08c25aef25a2582ac3c9a9e36ccb7cf3f3256da3 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 9 Feb 2022 09:52:07 +0100 Subject: [PATCH] TextEditor: Fix High-DPI+Qt6 drawing of the refactor marker icon Subtle devicePixelRatio-related changes in Qt require to restrict one division by a Qt 5 specific #ifdef. Fixes: QTCREATORBUG-26905 Change-Id: Ic5eecef5c7cb355abc8a5391708c5cd1050af282 Reviewed-by: Reviewed-by: David Schulz --- src/plugins/texteditor/refactoroverlay.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/refactoroverlay.cpp b/src/plugins/texteditor/refactoroverlay.cpp index 2906ef045cc..5c1c56ad7e6 100644 --- a/src/plugins/texteditor/refactoroverlay.cpp +++ b/src/plugins/texteditor/refactoroverlay.cpp @@ -87,7 +87,10 @@ void RefactorOverlay::paintMarker(const RefactorMarker& marker, QPainter *painte const QSize proposedIconSize = QSize(m_editor->fontMetrics().horizontalAdvance(QLatin1Char(' ')) + 3, cursorRect.height()) * devicePixelRatio; - const QSize actualIconSize = icon.actualSize(proposedIconSize) / devicePixelRatio; + QSize actualIconSize = icon.actualSize(proposedIconSize); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + actualIconSize /= devicePixelRatio; +#endif // Qt < 6.0 const int y = cursorRect.top() + ((cursorRect.height() - actualIconSize.height()) / 2); const int x = cursorRect.right();