
_START_ARTICLE_
QML
_START_SECTION_
基本语法
_START_PARAGRAPH_
示例：_NEWLINE_import QtQuick 1.0_NEWLINE__NEWLINE_ Rectangle {_NEWLINE_     id: canvas_NEWLINE_     width: 200_NEWLINE_     height: 200_NEWLINE_     color: "blue"_NEWLINE__NEWLINE_     Image {_NEWLINE_         id: logo_NEWLINE_         source: "pics/logo.png"_NEWLINE_         anchors.centerIn: parent_NEWLINE_         x: canvas.height / 5_NEWLINE_     }_NEWLINE_ }
_START_SECTION_
动画
_START_PARAGRAPH_
Rectangle {_NEWLINE_     id: rect_NEWLINE_     width: 120; height: 200_NEWLINE__NEWLINE_     Image {_NEWLINE_         id: img_NEWLINE_         source: "pics/qt.png"_NEWLINE_         x: 60 - img.width/2_NEWLINE_         y: 0_NEWLINE__NEWLINE_         SequentialAnimation on y {_NEWLINE_             loops: Animation.Infinite_NEWLINE_             NumberAnimation { to: 200 - img.height; easing.type: Easing.OutBounce; duration: 2000 }_NEWLINE_             PauseAnimation { duration: 1000 }_NEWLINE_             NumberAnimation { to: 0; easing.type: Easing.OutQuad; duration: 1000 }_NEWLINE_         }_NEWLINE_     }_NEWLINE_ }
_START_SECTION_
Qt 信号处理式
_START_PARAGRAPH_
MouseArea {_NEWLINE_     onPressed: console.log("mouse button pressed")_NEWLINE_ }
_START_SECTION_
开发工具
_START_PARAGRAPH_
由于 QML 和 Javascript 的语法相似，大多数支持Javascript 的编辑器均可编辑QML。但是从Qt Creator 的 2.1 版本开始，该 IDE 提供了完整的语法高亮、代码补全、内建帮助和所见即所得编辑器。在商业版本的Creator 中，所见即所得编辑器还会提供更多的功能。