Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to open a new window in Android?
Forum Updated to NodeBB v4.3 + New Features

How to open a new window in Android?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 2 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tarod.net
    wrote on last edited by
    #1

    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.

    Anyway, what is the best way of opening a subwindow using QML?

    "Individually, we are one drop. Together, we are an ocean."

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      I think Android does not support multi-window applications. However, creating subwindows works fine on Android, when using QtWidgets... so maybe it's a deficiency in the QML port. Try using the newest possible version of Qt, maybe it works there (Qt 5.3.2 snapshot, or 5.4 alpha).

      (Z(:^

      1 Reply Last reply
      0
      • T Offline
        T Offline
        tarod.net
        wrote on last edited by
        #3

        So, the Window QML type cannot be used for Android applications?

        "Individually, we are one drop. Together, we are an ocean."

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tarod.net
          wrote on last edited by
          #4

          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.

          "Individually, we are one drop. Together, we are an ocean."

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Good to know, thanks for sharing.

            (Z(:^

            1 Reply Last reply
            0
            • T Offline
              T Offline
              tarod.net
              wrote on last edited by
              #6

              Thanks to you, sierdzio.

              "Individually, we are one drop. Together, we are an ocean."

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved