aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHyunkook Khang <hyunkook.khang@qt.io>2021-02-23 10:51:31 +0900
committerMitch Curtis <mitch.curtis@qt.io>2021-05-26 13:51:21 +0200
commit6b687ad7ec46fed10766f5d26809c4fe430db608 (patch)
treee7894ddb58b4735339a9137e4d9e923fb9ac6bfb /src
parent14d35455e351f50ce91e71b1e27f6ee58c0c8fd0 (diff)
Fix layout is always RTL when locale is RTL
isMirrored() will always return true when locale is RTL, so that we cannot change the layout. To fix this, remove out the relation between LayoutMirroring.enabled and locale's text direction. [ChangeLog][Controls][Important Behavior Changes] Control's locale property no longer affects layout direction. Use LayoutMirroring instead. Fixes: QTBUG-91227 Change-Id: Ibedd3f09828f81f1889077892452a27c90e21533 Reviewed-by: Hyunkook Khang <hyunkook.khang@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/quicktemplates2/qquickapplicationwindow.cpp2
-rw-r--r--src/quicktemplates2/qquickcontrol.cpp19
2 files changed, 9 insertions, 12 deletions
diff --git a/src/quicktemplates2/qquickapplicationwindow.cpp b/src/quicktemplates2/qquickapplicationwindow.cpp
index 62679110..00cab471 100644
--- a/src/quicktemplates2/qquickapplicationwindow.cpp
+++ b/src/quicktemplates2/qquickapplicationwindow.cpp
@@ -635,7 +635,7 @@ void QQuickApplicationWindow::resetFont()
the window's locale, that locale propagates to all child controls in the
window, overriding the system default locale.
- \sa Control::locale, {LayoutMirroring}{LayoutMirroring}
+ \sa Control::locale
*/
QLocale QQuickApplicationWindow::locale() const
{
diff --git a/src/quicktemplates2/qquickcontrol.cpp b/src/quicktemplates2/qquickcontrol.cpp
index c07a097b..89f6abd4 100644
--- a/src/quicktemplates2/qquickcontrol.cpp
+++ b/src/quicktemplates2/qquickcontrol.cpp
@@ -232,8 +232,7 @@ void QQuickControlPrivate::handleUngrab()
void QQuickControlPrivate::mirrorChange()
{
Q_Q(QQuickControl);
- if (locale.textDirection() == Qt::LeftToRight)
- q->mirrorChange();
+ q->mirrorChange();
}
void QQuickControlPrivate::setTopPadding(qreal value, bool reset)
@@ -636,13 +635,10 @@ void QQuickControlPrivate::updateLocale(const QLocale &l, bool e)
QLocale old = q->locale();
hasLocale = e;
if (old != l) {
- bool wasMirrored = q->isMirrored();
locale = l;
q->localeChange(l, old);
QQuickControlPrivate::updateLocaleRecur(q, l);
emit q->localeChanged();
- if (wasMirrored != q->isMirrored())
- q->mirrorChange();
}
}
@@ -1246,7 +1242,7 @@ void QQuickControl::resetSpacing()
control's locale, that locale propagates to all of the control's children,
overriding the system default locale.
- \sa mirrored, {LayoutMirroring}{LayoutMirroring}
+ \sa mirrored
*/
QLocale QQuickControl::locale() const
{
@@ -1280,16 +1276,17 @@ void QQuickControl::resetLocale()
This property holds whether the control is mirrored.
This property is provided for convenience. A control is considered mirrored
- when its visual layout direction is right-to-left; that is, when using a
- right-to-left locale or when \l {LayoutMirroring::enabled}{LayoutMirroring.enabled}
- is \c true.
+ when its visual layout direction is right-to-left; that is, when
+ \l {LayoutMirroring::enabled}{LayoutMirroring.enabled} is \c true.
- \sa locale, {LayoutMirroring}{LayoutMirroring}, {Right-to-left User Interfaces}
+ As of Qt 6.2, the \l locale property no longer affects this property.
+
+ \sa {LayoutMirroring}{LayoutMirroring}, {Right-to-left User Interfaces}
*/
bool QQuickControl::isMirrored() const
{
Q_D(const QQuickControl);
- return d->isMirrored() || d->locale.textDirection() == Qt::RightToLeft;
+ return d->isMirrored();
}
/*!