MenuBar Right to Left
-
Hello,
I want to make the app flow from right to left , I changed layout direction in the main.py to be right to left, but it doesn't make the flow

code for main.py
# This Python file uses the following encoding: utf-8 import sys import os from PySide2.QtGui import QGuiApplication from PySide2.QtQml import QQmlApplicationEngine from PySide2 import QtCore if __name__ == "__main__": app = QGuiApplication(sys.argv) app.setLayoutDirection(QtCore.Qt.RightToLeft) #Change right to left engine = QQmlApplicationEngine() engine.load(os.path.join(os.path.dirname(__file__), "main.qml")) if not engine.rootObjects(): sys.exit(-1) sys.exit(app.exec_())code for main.qml
import QtQuick 2.12 import QtQuick.Controls 2.12 import QtQuick.Dialogs 1.2 ApplicationWindow{ width: 1200 height: 480 visible: true background: Rectangle{ color: 'white' } menuBar: MenuBar{ Menu{ title: qsTr("First Menu") } Menu{ title: qsTr("Second Menu") } Menu{ title: qsTr("Third Menu") } } } -
MenuBar uses a Row; this is implemented via layout mirroring, see https://doc.qt.io/qt-6/qml-qtquick-layoutmirroring.html#details .
For example:
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
LayoutMirroring.childrenInherit: true