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. Advise on multiple top level QQuickView's
Forum Updated to NodeBB v4.3 + New Features

Advise on multiple top level QQuickView's

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 2 Posters 4.3k 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.
  • C Offline
    C Offline
    CCob
    wrote on last edited by
    #1

    Hi,

    I have an upcoming project that I would like Qt Quick 2 for, this particular project requires two top level scenes, full screen, on 2 separate monitors but they do have a requirement to share qml items. What is the best way to achieve this? Would multiple QQuickView's work sharing the same QQmlEngine or is there a better approach?

    Thanks

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jens
      wrote on last edited by
      #2

      Qt Quick 2 has built-in support for this. If you write the entire UI in Qt Quick, you can instead declare multiple instances of Window or ApplicationWindow in QML itself and use the non visual QQmlApplicationEngine to launch your app and implicitly create those windows using the same engine.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CCob
        wrote on last edited by
        #3

        Right, so the top level QML file loaded by QQmlApplicationEngine would simply have 2 top level Window items inside it? I gather these can be configured to setScreen and fullscreen also then?

        1 Reply Last reply
        0
        • J Offline
          J Offline
          Jens
          wrote on last edited by
          #4

          Yes. If you check the Window api here:
          http://doc-snapshot.qt-project.org/qt5-stable/qtquick/qml-qtquick-window2-window.html

          1 Reply Last reply
          0
          • C Offline
            C Offline
            CCob
            wrote on last edited by
            #5

            Thought you could only have one top level qml root node? If this is the case how can I achieve 2 top level windows in qml. Seems both windows would always need a top level parent?

            Thanks

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jens
              wrote on last edited by
              #6

              Unlike QQuickView, your root node can be a simple QtObject if you are using QmlApplicationEngine. So in effect there is no such constraint.

              @

              QtObject {

              property var test: Window {
              width: 100
              height: 100
              visible: true
              }
              property var test2: Window {
              width: 100
              height: 100
              visible: true
              }
              }
              @

              Note that windows are not visible by default so you have to explicitly make them visible when doing this. (Root windows are implicitly set visible otherwise)

              1 Reply Last reply
              0
              • C Offline
                C Offline
                CCob
                wrote on last edited by
                #7

                excellent, thanks for your help

                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