I'm new in a rather large QML codebase and I want to know the properties of the QML element I click on when running the application, e.g. objectName.
E.g. the name "button" in this main.qml.
The equivalent in Qt is QApplication::widgetAt()
or QWidget::childAt()
I can call in a QMouseEvent.
I need these to identify QML objects within a mixed Qt/QML application for cucumber-cpp step implementations, where I already have a Helper::click(QString name)
. I put up an example project here: https://github.com/elsamuko/qml_demo
I have a solution, I can work with.
First I implement
mousePressEvent
fromQQuickView
in a derived class.Then with
findChildren<QObject*>
on theQQuickView
object, I can find and debug the QML objects. Strangely,childAt
andchildren
do not list the QML child objects.The complete project is here:
https://github.com/elsamuko/qml_demo