Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Is it possible to use any QML Parser Tool?
utkuf last edited by
Is it possible to use any QML Parser Tool in order to see how we should parse our Qml Application which has also use C++ libraries thanks to qmlRegisterType ???
joeal last edited by joeal
All QML signals are automatically available to C++, and can be connected to using QObject::connect() like any ordinary Qt C++ signal. In return, any C++ signal can be received by a QML object using signal handlers. WalgreensListens
utkuf last edited by
I do not tell about qml signall or c++ relationship. I would like to learn are there any qml parser tool which parse/split/divide all qml code with respect to dependencies of qml class/library etc.
I have not seen any such tools but you could roll your own using the parser from Qt
KH-219Design last edited by
Are you looking to do error-checking and error-prevention by ensuring (before "shipping" an application) that all your C++ types that should be registered are, indeed, actually properly registered?
If that is your goal, then I commend you. I am interested in that topic as well.
So far, I have been able to greatly increase detection of many such issues using a combination of:
- total ban on "qml warnings". (things that qml prints as "warnings" tend to be what I consider fatal bugs).
- launch the application during automated testing
- use automated scripts to scan the output of the launched application for any forbidden output such as "unregistered datatype" and "failed to load component"
The ban on warnings that I mention in point (1) is achieved by installing (in C++) a Qt custom message handler to spy on all logged messages and abort if any messages are "warnings" emanating from a
Launching the application during C.I. on a headless machine is done with Xvfb: https://github.com/219-design/qt-qml-project-template-with-ci/blob/4d81552d772c32b7d62edb4b4f0f678ca92bed4f/run_all_tests.sh#L50
The warnings-ban could be used on any platform.
Xvfbautomation, to my knowledge, would be limited to Linux applications. Therefore a parser-based detection system could be a more cross-platform portable solution.
If you come up with a parsing-based solution, I'm sure that I and many other users that combine C++ with QML would be happy to try out your solution.