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 add QML widgets in QGraphicsScene version QtQuick 2.0
Forum Updated to NodeBB v4.3 + New Features

How to add QML widgets in QGraphicsScene version QtQuick 2.0

Scheduled Pinned Locked Moved QML and Qt Quick
4 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.
  • S Offline
    S Offline
    september
    wrote on last edited by
    #1

    Hi everyone! how to add qml widget in QGraphicsScene version QtQuick 2.0? In The documentation only found out how to add widgets version QtQuick 1.0, and version QtQuick 2.0 no.
    @QGraphicsScene* scene = myExistingGraphicsScene();
    QDeclarativeEngine *engine = new QDeclarativeEngine;
    QDeclarativeComponent component(engine, QUrl::fromLocalFile("myqml.qml"));
    QGraphicsObject *object =
    qobject_cast<QGraphicsObject *>(component.create());
    scene->addItem(object);@

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

      Good, because it can't be done ;)

      QtQuick 1 is based on QGraphicsView, so integrating it with QGraphicsScene is possible. QtQuick 2 uses entirely separate graphics stack.

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        september
        wrote on last edited by
        #3

        What do I use for a place class QGraphicsScene ?

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

          I don't know why are you using QGraphicsScene, so I don't know which of the alternatives to offer. To combine QtWidgets with QtQuick module, you need to take a look at "createWindowContainer":http://qt-project.org/doc/qt-5.1/qtwidgets/qwidget.html#createWindowContainer() function.

          (Z(:^

          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