QtQuickTest: add custom C++ objects
in my application, I register custom C++ objects that I use in the GUI afterwards. I would like to unit test my application with QtQuickTest. However, the C++ objects are not found. So how can I register them so that I can use them when unit testing my app with QtQuickTest?¨
Thanks for any help.
Have you read the follwing link:
thanks for the link. It seems to be deprecated however. Also, I am more interested in QtQuickTest framework specifically, not QtQuick in general. Adding custom C++ objects to my QML application already works. But not with QtQuickTest unfortunately.
I know that this link is old. But it hasn't changed in QtQuick 2. The principal is the same.
Here the up to date link.
Now choose the link, Embedding C++ Object in QML.
When you register you C++ Object with QmlContext::setContextProperty
then you should also be able to access your C++ object in QML.
If this approach doesn't work, post a code example to analyse where the problem might be.