当我在 qml 文件中添加矩形对象时会发生什么?
添加一个矩形时,后面会发生什么
Rectangle{
width:40
heigh: 40
color:"blue"
}
当我在 qml 文件中
?什么调用什么并且绘制了一个蓝色矩形? 机制是什么?你能推荐一些读的东西吗,我找不到。 谢谢
What happens behind, when i add a rectangle
Rectangle{
width:40
heigh: 40
color:"blue"
}
in a qml file?
What invokes what and a blue rectangle has been drawn?
What is the mechanism? Can you advise something to read, i couldnot find.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说:
一旦你在assistant-qt4(主要的qt文档助手)中输入QGraphicsRectItem,你会感到肚子暖暖的,后来意识到你的qml代码“矩形”终于创建了一个。 Qt4 QtQuick 实现目前是 QGraphicsView/QGraphicsScene 的精简抽象。如上所述,步骤是相同的:
这些类都有很好的文档记录,一旦您了解了它们的原理,您就可以继续研究它们向 QDeclarative* 等的演变。不幸的是,后者的文档在某些细节上有些缺乏,但总体来说非常有用。当然,还有更多内容 - 但一旦您意识到源自 QGraphicsView/-Scene 类的 QtQuick 演变,其他一切都更加合乎逻辑。然后,瞥一眼源代码(缺少文档)会让您感觉更有针对性 - 因为您知道解析的标记如何最终收敛到 QGraphicsScene 中创建的 QGraphicsItem(QDeclarativeView,..)。
祝你好运!
In general:
You will get a warm belly feeling once you type QGraphicsRectItem into assistant-qt4 (the primary qt documentation assistant) and later realize that your qml code "Rectangle" is finally creating one. The Qt4 QtQuick implementation is currently a thin abstraction of QGraphicsView/QGraphicsScene. As above, the steps are the same:
These classes are exceptionally well documented, and once you understand their principle you are ready to go forward and study their evolution to QDeclarative* etc. Unfortunately the documentation of the latter is somewhat lacking in certain details, but overall very useful. Surely, there is more to it - but once your realize the QtQuick evolution originating from QGraphicsView/-Scene classes, everything else is much more logical. Then, a glimpse into the source code (where documentation was lacking) will make you feel much more oriented - as you have an idea how the parsed markup is finally converging into QGraphicsItem's beeing created in your QGraphicsScene (QDeclarativeView,..).
Good Luck!