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: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Alessandro Portale
2022-02-09 09:52:07 +01:00
parent bafea94402
commit 08c25aef25

View File

@@ -87,7 +87,10 @@ void RefactorOverlay::paintMarker(const RefactorMarker& marker, QPainter *painte
const QSize proposedIconSize = const QSize proposedIconSize =
QSize(m_editor->fontMetrics().horizontalAdvance(QLatin1Char(' ')) + 3, QSize(m_editor->fontMetrics().horizontalAdvance(QLatin1Char(' ')) + 3,
cursorRect.height()) * devicePixelRatio; 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 y = cursorRect.top() + ((cursorRect.height() - actualIconSize.height()) / 2);
const int x = cursorRect.right(); const int x = cursorRect.right();