tags:

views:

147

answers:

1

Hi everyone,

I am doing some tests in Qt Quick (Qt Declarative and QML), and i would like to inspect the elements composing the declarative interface.

For example, if i have a declarative GUI composed of a rectangle and two images, i would like to have a list with three (or more) elements with these widgets (or items in Qt Declarative).

In Qt4 it is as easy as call the QApplication::allWidgets() method, bout i don't know how to do it in QML.

The same happens with event filters, so i can not get the events sent to these items.

Cheers!!!

+1  A: 

You can get the root object this way:

QGraphicsObject * QDeclarativeView::rootObject () const

which gives you a QGraphicsObject, and then you can use:

QList<QGraphicsItem *> QGraphicsObject::childItems () const

childItems() is actually defined in QGraphicsItem, QGraphicsObject is child class of QGraphicsItem

digitalSurgeon
Hi,i have already solve this problem as we describe in:http://catedrasaes.inf.um.es/trac/blog/pedromateo-13/07/2010-qml_event_item_introspectionThanks anyway,Cheers!!!
pedromateo