Solved Android Open a window from menu
-
Good Morning, I have to open a window by cliking in the menu how I do?
thi s is my code QML:
import QtQuick 2.0 import QtQuick.Controls 2.5 import QtQuick.Layouts 1.12 ApplicationWindow { id: window width: 500 height: 500 visible:true Rectangle { id: rectangle color: "#212126" anchors.fill: parent } header: ToolBar { background:Rectangle { implicitHeight: 40 color: "beige" } RowLayout { anchors.fill: parent ToolButton { text: qsTr("‹") onClicked: stackView.pop() } Label { text: "App Paolo" elide: Label.ElideRight horizontalAlignment: Qt.AlignHCenter verticalAlignment: Qt.AlignVCenter Layout.fillWidth: true } ToolButton { text: qsTr("⋮") onClicked: { menu.x = (window.width - menu.width) / 1 menu.y = 10 menu.open()} } } } ListModel { id: pageModel ListElement { title: "Riparazioni" page: "Riparazioni.qml" } ListElement { title: "Magazzino" page: "Magazzino.qml" } } StackView { id: stackView anchors.fill: parent // Implements back key navigation focus: true // //Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) { // stackView.pop(); // event.accepted = true; // } initialItem: Item { width: parent.width height: parent.height ListView { model: pageModel anchors.fill: parent delegate: AndroidDelegate { text: title onClicked: stackView.push(Qt.resolvedUrl(page)) } } } } StackView { id: stack anchors.fill: parent } Menu { id: menu MenuItem{ text: "Settings" onClicked: { stackView.push(Qt.resolvedUrl(Settings)) } } } }
-
I answer myself I did so and it works, it was too trivial
MenuItem{ text: "Settings" onClicked: { stackView.push("Settings.qml") }