Hi,
I'm trying to show a new window after clicking in the menu. I'm creating the windows as a new component. Something like this:
onTriggered: {
var component = Qt.createComponent("Info.qml");
if (component.status == Component.Ready) {
/*
* The created object will become a child of the appWindow
* item in main.qml.
*/
var object = component.createObject(mainWindow);
object.show()
} else if (component.status == Component.Error) {
// Error Handling
console.log("Error loading component:", component.errorString());
}
}
onTriggered: {
var component = Qt.createComponent("Info.qml");
if (component.status == Component.Ready) {
/*
* The created object will become a child of the appWindow
* item in main.qml.
*/
var object = component.createObject(mainWindow);
object.show()
} else if (component.status == Component.Error) {
// Error Handling
console.log("Error loading component:", component.errorString());
}
}
To copy to clipboard, switch view to plain text mode
Info.qml:
Window {
id: info
title: qsTr("Info")
width: 340
height: 280
visible: true
Text {
text: "Hello World!"
font.pointSize: 24
}
}
Window {
id: info
title: qsTr("Info")
width: 340
height: 280
visible: true
Text {
text: "Hello World!"
font.pointSize: 24
}
}
To copy to clipboard, switch view to plain text mode
If I launch the desktop application everything goes well, but if I launch the application in my Android emulator, when I press the menu, I don't see the window.
It seems it is created because I cannot continue using the application unless I press ESC in the keyboard. I guess that ESC is closing the window.
Bookmarks