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. Sharing QDeclarativeEngine between different windows
Qt 6.11 is out! See what's new in the release blog

Sharing QDeclarativeEngine between different windows

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

    Hello,

    I'm trying to implement an application where the user is able to open selected QDeclarativeItems in an external window. Therefore I just want to remove the object from the main window's scene and add it to the scene of the newly created window:

    There are two ways that come to my mind on how to handle this:

    • Opening a new QDeclarativeView and add the object to its scene
      Drawback: I'm not sure how this messes up with the context of the object (if it even works), since this view uses another instance of QDeclarativeEngine internally.

    • Opening a new QGraphicsView and add the object to the scene, which let's me share the same engine between multiple views.
      Drawback: All of the convenience from the QDeclarativeView is gone, auto resizing, optmized QGraphicsView settings, etc have to be handwritten again.

    I'm I right with this assumptions?

    And if yes, what would others say to the idea of at least offering a QDeclarativeView constructor, which takes a QDeclarativeEngine instead of creating a new one. I see no need in having multiple engines in the application since I may have differend contexts. And since I had a short look into the code, this may only be a minor change to it.

    Or is there anything technical speaking against this idea?

    Regards,
    Bernhard

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mbrasser
      wrote on last edited by
      #2

      [quote author="Bernhard Roth" date="1319448312"]And if yes, what would others say to the idea of at least offering a QDeclarativeView constructor, which takes a QDeclarativeEngine instead of creating a new one. I see no need in having multiple engines in the application since I may have differend contexts. And since I had a short look into the code, this may only be a minor change to it.
      [/quote]

      I think this, and/or a setEngine function would be a nice addition.

      I'd recommend adding a suggestion to https://bugtracker.qt.nokia.com (and if you are interested, you can submit an implementation via http://codereview.qt-project.org :-)

      Regards,
      Michael

      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