My setup is Qt5.0.2 MinGW 32-bit.
I am looking for { Qt5.0.2 / QML / QtQuick2.0 / C++ }
code project examples (not Qt Quick 1.0
) that have actual C++ classes or at least a main.cpp
.
I ran through the web, browsed all examples I could possibly find:
- http://qt-project.org/ website;
- github;
- stack overflow (if anyone had previously addressed this question);
- http://www.developer.nokia.com/Develop/Qt/Code_examples/
but they were either old (Qt Quick 1.0) or pure QML+ QtQuick 2.0 or did not compile at all; or if they could compile, they showed me empty dialogs (for example, the "Status Shout!" in the Nokia code examples).
Any advice would be highly appreciated.
There aren't really all that much detailed resources on QML, most of what is available is just short snippet examples and documentation examples. This is a problem for people who are new to programming, because such materials don't really give an idea of how to put together something that is useful in practice.
This is true even more so for QtQuick2, which is brand new, and even the documentation and many of the official examples are still incomplete. And I know from experience how frustrating it is to follow a tutorial, type everything, expect it to work, and get something unexpected, with no idea what really went wrong and how to fix it.
That being said, there are a few examples of complete, albeit trivial games, that are implemented in QtQuick1. This is not that big of an issue since QtQuick2 elements are backward compatible and the code will work with QtQuick2 with little to no modifications at all.
The official examples, while occasionally broken or incomplete, can also be of help, plus they will likely be fixed soon (it's about time):
Last but not least, QML snippets from the Qt project website wiki:
EDIT: To add another good resource for learning QML: http://qmlbook.org
A rather minimal example would be:
main.cpp
foo.qml (here bundled as resource):