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. [SOLVED] QtQuick-Plugin - get QmlViewer object
QtWS25 Last Chance

[SOLVED] QtQuick-Plugin - get QmlViewer object

Scheduled Pinned Locked Moved QML and Qt Quick
3 Posts 2 Posters 1.5k Views
  • 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
    selectedOne
    wrote on last edited by
    #1

    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
    0
    • S Offline
      S Offline
      stevenceuppens
      wrote on last edited by
      #2

      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
      0
      • S Offline
        S Offline
        selectedOne
        wrote on last edited by
        #3

        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
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved