PDA

View Full Version : How to open a new window in Android?



tarod
2nd September 2014, 17:00
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());
}
}


Info.qml:



Window {
id: info
title: qsTr("Info")

width: 340
height: 280
visible: true

Text {
text: "Hello World!"
font.pointSize: 24
}
}



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.

tarod
5th September 2014, 16:24
Maybe the port of QML Window to Android is not very well implemented.

The window is created but not showed. I'm sure the window is running thanks to some logs and because if I touch the screen in the area where the window is supposed to be, the object (i.e. a button) under that area is not receiving the focus or the events.

So, after this bad experience, I've used a MessageDialog instead of a Window.