Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Force LeftToRight using LayoutMirroring
Forum Updated to NodeBB v4.3 + New Features

Force LeftToRight using LayoutMirroring

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
layoutmirroringright-to-leftleft-to-right
2 Posts 1 Posters 621 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mbnoimi
    wrote on last edited by mbnoimi
    #1

    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
    
    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbnoimi
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved