diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-04-20 11:16:57 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2020-04-21 09:46:14 +0000 |
commit | 589e34eb3210d8725d68941dbeb096424dda68df (patch) | |
tree | 55cc647f09eddc7abd1e46911b7d487d619fb366 /src/widgets/widgets/qwidgetlinecontrol_p.h | |
parent | df234035d0b4c422707a3ad8d893742da6922d10 (diff) |
Don't fall back to QGuiApplication for line control's layoutDirection
If the widget whose line control we are has its own locale setting,
then we should use that rather than the default UI layout direction.
Instead, the client of the QWidgetLineControl needs to handle the case
where auto-detection of the text direction can't be done based on the
content of the line control.
Fortunately, QWidget's handling of text direction handles setting to
auto gracefully as unsetting, on which it consults the parent widget
to set a sensible default.
Change-Id: Id0d247f1e6e7219b6d0ece5856ca93ee87778c74
Pick-to: 5.15
Fixes: QTBUG-53110
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/widgets/widgets/qwidgetlinecontrol_p.h')
-rw-r--r-- | src/widgets/widgets/qwidgetlinecontrol_p.h | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h index a8fffd23dc..357b541362 100644 --- a/src/widgets/widgets/qwidgetlinecontrol_p.h +++ b/src/widgets/widgets/qwidgetlinecontrol_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtWidgets module of the Qt Toolkit. @@ -354,11 +354,8 @@ public: void setPasswordMaskDelay(int delay) { m_passwordMaskDelay = delay; } Qt::LayoutDirection layoutDirection() const { - if (m_layoutDirection == Qt::LayoutDirectionAuto) { - if (m_text.isEmpty()) - return QGuiApplication::inputMethod()->inputDirection(); + if (m_layoutDirection == Qt::LayoutDirectionAuto && !m_text.isEmpty()) return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight; - } return m_layoutDirection; } void setLayoutDirection(Qt::LayoutDirection direction) |