Force LeftToRight using LayoutMirroring



  • Hi,

    How can I force set LayoutMirroring to false value?

    The following snippet can't show textField_host correctly using LANG=ar_SY.UTF-8 as shown in the screenshot:

    main.qml

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    
    ApplicationWindow {
        id: applicationWindow
        visible: true
        width: 640
        height: 480
        title: qsTr("Hello World")
        LayoutMirroring.childrenInherit: true
    
        TextField {
            LayoutMirroring.enabled: false
            id: textField_host
            x: 89
            y: 24
            text: qsTr("192.168.1.2")
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.verticalCenter: parent.verticalCenter
            inputMethodHints: Qt.ImhDigitsOnly
            Layout.fillWidth: true
            inputMask: "999.999.999.999"
    
            Component.onCompleted: {
                console.log((Qt.application.layoutDirection == Qt.RightToLeft) ? "RTL" : "LTR")
                console.log(LayoutMirroring.enabled)
            }
        }
    }
    

    Case LANG=ar_SY.UTF-8
    LANG=ar_SY.UTF-8
    The result
    alt text
    Log

    QML debugging is enabled. Only use this in a safe environment.
    qml: RTL
    qml: false
    

    Case LANG=en_US.UTF-8
    LANG=en_US.UTF-8
    The result
    alt text
    Log

    QML debugging is enabled. Only use this in a safe environment.
    qml: LTR
    qml: false
    


  • Guys I tried the following but unfortunately I still see TextField in RTL

     TextField {
            LayoutMirroring.enabled: false
            LayoutMirroring.childrenInherit: false
            ...
    }
    

    Can I get some help here?

    Thanks in advance.



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.