Open another QML window
-
Hi. I'm newbie in development in QT, and I have a question about loading another window when clicking on button in first window. I have two QML files with different styles. I need to open window from second QML when clicking on first.
I have this:
My main file calendar.qml:import QtQuick 2.2 import QtQuick.Window 2.10 .... Window { id: root visible: true .... someclasses { property variant win; MouseArea { onClicked: { if (mouse.button === Qt.RightButton) { .... } else { var component = Qt.createComponent("viewevent.qml"); win = component.createObject(); //win.show(); //win.setEvent(maincalendar.selectedDate, modelData); } } } } }
My viewevent.qml file:
import QtQuick 2.2 import QtQuick.Window 2.10 .... Window { id: eventWindow visible: true someclasses { .... } function setEvent(date, event) { .... } }
So, how can I open window eventWindow from my root, or maybe change view for it, like part of child window in main window. Or maybe any another ideas for creating another 'activity' for application (because it will run on android). Or maybe I need to add in engine this QML, and if it is, how can I do that. And when creating child, how execute it's function (here is setEvent). Thank you.
-
Hi @AriosJentu
Have a look at https://doc.qt.io/qt-5/qml-qtquick-controls-stackview.html -
This post is deleted!