Results 1 to 2 of 2

Thread: How to open a new window in Android?

  1. #1
    Join Date
    Nov 2007
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to open a new window in Android?

    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:

    Qt Code:
    1. onTriggered: {
    2.  
    3. var component = Qt.createComponent("Info.qml");
    4. if (component.status == Component.Ready) {
    5. /*
    6.   * The created object will become a child of the appWindow
    7.   * item in main.qml.
    8.   */
    9. var object = component.createObject(mainWindow);
    10. object.show()
    11. } else if (component.status == Component.Error) {
    12. // Error Handling
    13. console.log("Error loading component:", component.errorString());
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 

    Info.qml:

    Qt Code:
    1. Window {
    2. id: info
    3. title: qsTr("Info")
    4.  
    5. width: 340
    6. height: 280
    7. visible: true
    8.  
    9. Text {
    10. text: "Hello World!"
    11. font.pointSize: 24
    12. }
    13. }
    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.

  2. #2
    Join Date
    Nov 2007
    Posts
    36
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to open a new window in Android?

    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.

Similar Threads

  1. launching animated window from already open window
    By krystosan in forum Qt Programming
    Replies: 6
    Last Post: 15th December 2013, 14:06
  2. Qt 5.1.1 Android: How to initialize and show OpenGL window on GUI event?
    By Thomas13 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 3rd October 2013, 13:28
  3. Replies: 2
    Last Post: 14th January 2013, 08:07
  4. Replies: 3
    Last Post: 23rd December 2010, 07:55
  5. Replies: 0
    Last Post: 10th September 2010, 14:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.