Slider LayoutMirroring.Enabled: false. Still mirrored in Arabic
-
// I don't want the slider to be mirrored for the Arabic region.
// But setting LayoutMirroring.enabled: false doesn't seem to workimport QtQuick 2.12
import QtQuick.Window 2.12
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15Window {
width: 640
height: 480
visible: true
title: qsTr("Hello World")ColumnLayout { LayoutMirroring.enabled: false Slider { LayoutMirroring.enabled: false from:1 to:100 value:90 anchors.left: parent.left } Text { id: name text: qsTr("Slider Value : ") + root.value } }}

-
Hello,
I encountered the same problem when mirroring application in qml. Since there are few questions and even fewer anwers regarding this subject I like to add my solution to this post so people in the future might find this:The problem is that the slider is a qml control and therefor has the mirrored property. The mirrored property indicates if the control (in this case the slider) is mirrored or not and determines this by looking at two things
- The LayoutMirroring.enabled attached property
or - The layout direction in the current locale. (Locale contains the current selected language and the direction defined within - you can check your locale direction by printing the textDirection property of the locale)
So even if you set the LayoutMirroring.enabled to false controls will still mirror themselfs if you use e.g. and RTL locale, like arabic in this case.
The solution for me was now to set an english (or any LTR) locale manually for the slider component so it won't use the arabic one and therefor is not forced to mirror anymore.
Slider { locale: Qt.locale("english") // "english" must be replaced with your name for the english locale } - The LayoutMirroring.enabled attached property