Sharing QDeclarativeEngine between different windows



  • 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



  • [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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.