diff options
| author | Christian Ehrlicher <[email protected]> | 2024-05-04 16:11:01 +0200 |
|---|---|---|
| committer | Christian Ehrlicher <[email protected]> | 2024-05-08 19:58:17 +0200 |
| commit | 5ea248155654b58fcb52ef326dc4d94de83d0409 (patch) | |
| tree | 5c79dd8133bc675ead077235fc660d9690ab328b /src/widgets/kernel | |
| parent | c587eeef11a00866347e44ec4e701c7775558a07 (diff) | |
QWidget: fix render() in RTL mode
Rendering a widget to a paintdevice via QWidget::render() did not pass
the LayoutDirection mode of the widget to the paintdevice which lead to
wrong rendering of text.
This is especially visible with the windows 11 style which does not draw
some widgets directly on the screen but through a QGraphicsEffect on a
QImage.
Pick-to: 6.7 6.5 6.2
Fixes: QTBUG-124931
Change-Id: If2cfa326d2ca45c42e203a4ae91fd857afa5c69c
Reviewed-by: Axel Spoerl <[email protected]>
Reviewed-by: Wladimir Leuschner <[email protected]>
Diffstat (limited to 'src/widgets/kernel')
| -rw-r--r-- | src/widgets/kernel/qwidget.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index e8342a47889..6eff4abfb02 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5160,6 +5160,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, const QRegion oldSystemClip = enginePriv->systemClip; const QRegion oldBaseClip = enginePriv->baseSystemClip; const QRegion oldSystemViewport = enginePriv->systemViewport; + const Qt::LayoutDirection oldLayoutDirection = painter->layoutDirection(); // This ensures that all painting triggered by render() is clipped to the current engine clip. if (painter->hasClipping()) { @@ -5168,6 +5169,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, } else { enginePriv->setSystemViewport(oldSystemClip); } + painter->setLayoutDirection(layoutDirection()); d->render(target, targetOffset, toBePainted, renderFlags); @@ -5175,6 +5177,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset, enginePriv->baseSystemClip = oldBaseClip; enginePriv->setSystemTransformAndViewport(oldTransform, oldSystemViewport); enginePriv->systemStateChanged(); + painter->setLayoutDirection(oldLayoutDirection); // Restore shared painter. d->setSharedPainter(oldPainter); |
