Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    [SOLVED] QtQuick-Plugin - get QmlViewer object

    QML and Qt Quick
    2
    3
    1347
    Loading More Posts
    • 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
      selectedOne last edited by

      Hi guys,

      i wrote a QtQuick-Plugin in C++.
      One of my Classes should be possible to manipulate the QmlViewer.

      So... when an Object of my Class is created by the QmlViewer i want to get a pointer to the QmlViewer Object.
      Does anyone know a way to get the QmlViewer Object in a QtQuick-Plugin Class?

      Btw, using Qt 4.8.4 with Creator 2.5.2 on Windows.

      Mark

      1 Reply Last reply Reply Quote 0
      • S
        stevenceuppens last edited by

        Hi Mark,

        In Qt4, QtQuick items are a subclass of QDeclarativeItem.

        QDeclarativeItem has a member function:

        @QGraphicsScene * QGraphicsItem::scene () const@

        which returns the scene your item is created in,

        Scene itself has a member function:

        @QList<QGraphicsView *> QGraphicsScene::views () const@

        which returns the views that are rendering the scene.

        your QmlViewer is probably a subclass of the first item in this QList ?

        Steven CEUPPENS
        Developer &#x2F; Architect
        Mobile: +32 479 65 93 10

        1 Reply Last reply Reply Quote 0
        • S
          selectedOne last edited by

          When I said QmlViewer I meant the Qt qmlviewer.exe.
          So you solved my problem.

          The thing is, is have an application which loads n instances of the qml viewer as an DLL.
          My QtQuick item has an static List which collects the pointers of all created elements of this type.
          And with the QGraphicsItem::scene () mehod I can find out, which elements are on the same qml viewer page. :)

          1 Reply Last reply Reply Quote 0
          • First post
            Last post