Open a secondary window ans sent messages to it
-
Hi all,
I need to create a main window and together a secondary window, both visible.
The main window contains some controls (buttons and up/down control): when the user presses one of these control I need to send a 'message' to the secondary window that will update some text content.
First problem is to create the window: when I can create it?
How?
So far I'm trying to create it on a click of my custom control:ApplicationWindow { id: root visible: true width: 640 height: 480 title: qsTr("Baseball Table") property var win; MainForm { anchors.fill: parent upDownStrike.onPressedUp: { console.log("Strk+") var component = Qt.createComponent("qrc:/Table.qml"); root.win = component.createObject(root); if (root.win){ root.win.show(); } } upDownStrike.onPressedDown: console.log("Strk-") }
This way I receive the error:
qml: Strk+ QQmlComponent: Component is not ready
so the event is triggered but there is something wrong in my (simple) code.
Which type the Secondary window should be? Item ? ApplicationWindow ?Once created the window, how can i send some message/information to secondary window?
Thanks!
-
You can check the status of component with its
status
property and theerrorString()
method.