{ Qt5.0.2/QML/QtQuick2.0/C++ } 运行没有错误的示例项目?
我的设置是 Qt5.0.2 MinGW 32 位.
我正在寻找 { Qt5.0.2/QML/QtQuick2.0/C++ }
具有实际 C++ 类或在至少一个 main.cpp
.
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/ 网站;
- github;
- 堆栈溢出(如果之前有人解决过这个问题);
- http://www.developer.nokia.com/Develop/Qt/Code_examples/
但它们要么是旧的(Qt Quick 1.0),要么是纯的QML+ QtQuick 2.0,或者根本没有编译;或者如果他们可以编译,他们会向我展示空对话框(例如,诺基亚代码示例中的Status Shout!").
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.
推荐答案
关于 QML 并没有那么多详细的资源,大部分可用的只是简短的代码片段示例和文档示例.这对于刚接触编程的人来说是个问题,因为这些材料并没有真正说明如何组合一些在实践中有用的东西.
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.
对于全新的 QtQuick2 更是如此,甚至文档和许多官方示例仍然不完整.而且我从经验中知道,按照教程输入所有内容、期望它能够正常工作并得到一些意想不到的东西是多么令人沮丧,却不知道真正出了什么问题以及如何解决它.
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.
话虽如此,QtQuick1 中实现了一些完整的游戏示例,尽管它们是微不足道的.这不是什么大问题,因为 QtQuick2 元素是向后兼容的,并且代码可以与 QtQuick2 一起使用,几乎不需要修改.
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.
- Qt 快速游戏编程速成课程 - PDF
- Crash course to Qt Quick Game Programming - PDF
官方示例虽然偶尔会损坏或不完整,但也可能会有所帮助,而且它们可能很快就会修复(是时候了):
The official examples, while occasionally broken or incomplete, can also be of help, plus they will likely be fixed soon (it's about time):
- QtQuick(2) 代码示例
最后但同样重要的是,来自 Qt 项目网站 wiki 的 QML 片段:
Last but not least, QML snippets from the Qt project website wiki:
- QML 片段、教程、最佳实践、演示......
添加另一个学习 QML 的好资源:http://qmlbook.org
To add another good resource for learning QML: http://qmlbook.org
相关文章