<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh">
	<id>https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=QML</id>
	<title>QML - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://arolstar52-zhtest.hf.space/index.php?action=history&amp;feed=atom&amp;title=QML"/>
	<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=QML&amp;action=history"/>
	<updated>2026-07-13T03:10:16Z</updated>
	<subtitle>在这个wiki上该页的修订历史</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://arolstar52-zhtest.hf.space/index.php?title=QML&amp;diff=850872&amp;oldid=prev</id>
		<title>imported&gt;SchlurcherBot：​Bot: http → https</title>
		<link rel="alternate" type="text/html" href="https://arolstar52-zhtest.hf.space/index.php?title=QML&amp;diff=850872&amp;oldid=prev"/>
		<updated>2026-01-27T16:49:04Z</updated>

		<summary type="html">&lt;p&gt;Bot: http → https&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{howto|time=2016-05-25T03:20:33+00:00}}&lt;br /&gt;
{{review|time=2016-05-25T03:20:33+00:00}}&lt;br /&gt;
{{NoteTA|G1=IT}}&lt;br /&gt;
{{infobox programming language&lt;br /&gt;
| name                   = QML&lt;br /&gt;
| paradigm               = [[編程範型]]：[[宣告式編程]]、[[脚本语言]]&lt;br /&gt;
| year                   = 2009&lt;br /&gt;
| developer              = [[Qt發展框架]]&lt;br /&gt;
| latest_release_version = 5.14.1&amp;lt;ref&amp;gt;{{cite web|url=https://www.qt.io/blog/qt-5.14.1-released/|title=Qt 5.14.1 Released|date=2020-01-27|accessdate=2020-03-10|archive-date=2020-04-08|archive-url=https://web.archive.org/web/20200408194838/https://www.qt.io/blog/qt-5.14.1-released|dead-url=no}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
| latest release date    = {{Release date and age|2020|1|27}}&lt;br /&gt;
| latest_preview_version = &lt;br /&gt;
| latest_preview_date    = &lt;br /&gt;
| typing                 = [[類型系統|動態]]、[[強型別]]&lt;br /&gt;
| influenced_by          = [[JavaScript]]、[[Qt]]&lt;br /&gt;
| influenced = [[Qt]]&lt;br /&gt;
| website     = [https://doc.qt.io/qt-5/qtqml-index.html]&lt;br /&gt;
}}&lt;br /&gt;
{{Infobox file format&lt;br /&gt;
| name      = QML&lt;br /&gt;
| icon      = &lt;br /&gt;
| extension = .qml&lt;br /&gt;
| developer = [[Qt Project]]&lt;br /&gt;
| website   = {{URL|qt-project.org/doc/qt-5/qmlapplications.html}}&lt;br /&gt;
| genre     = [[脚本语言]]&lt;br /&gt;
}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;QML&amp;#039;&amp;#039;&amp;#039; (Qt Markup Language&amp;lt;ref&amp;gt;{{cite web|url=http://qt-project.org/doc/qt-4.8/qml-tutorial.html|title=Qt 4.8: QML Tutorial|accessdate=2013-10-31|archive-date=2013-11-02|archive-url=https://web.archive.org/web/20131102114647/http://qt-project.org/doc/qt-4.8/qml-tutorial.html|dead-url=no}}&amp;lt;/ref&amp;gt; 或 Qt Meta Language 或 Qt Modeling Language&amp;lt;ref&amp;gt;{{cite web |url=http://labs.qt.nokia.com/2009/08/21/qt-declarative-api-changes/#comment-4727 |title=Henrik Hartz (Product Manager for Qt Software at Nokia) comment on the name |date=24 August 2009 |accessdate=2011-06-14 |deadurl=yes |archiveurl=https://web.archive.org/web/20110723120216/http://labs.qt.nokia.com/2009/08/21/qt-declarative-api-changes/#comment-4727 |archivedate=2011-07-23 }}&amp;lt;/ref&amp;gt;) 是基於[[JavaScript]]、[[宣告式編程]]的[[程式語言]]，用於設計[[圖形使用者介面]]為主的應用程式。它是{{link-en|Qt Quick|Qt Quick}}，[[諾基亞]]開發的使用者介面建立套件的一部分。QML 主要用於行動應用程式，注重於觸控輸入、流暢的動畫（60張/秒）和使用者體驗。QML documents 描述元素的物件樹。&lt;br /&gt;
&lt;br /&gt;
QML 元素可以透過標準 JavaScript 增強，包括這 inline 和引入.js 檔。元素可以也無縫整合和使用 [[Qt]] 框架的 [[C++]] 元件擴展。&lt;br /&gt;
&lt;br /&gt;
語言的名稱是 QML。runtime的名稱是 QQuickView。&lt;br /&gt;
&lt;br /&gt;
== 語法、語義 ==&lt;br /&gt;
=== 基本語法 ===&lt;br /&gt;
&lt;br /&gt;
範例：&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;qml&amp;quot;&amp;gt;&lt;br /&gt;
import QtQuick 1.0&lt;br /&gt;
&lt;br /&gt;
 Rectangle {&lt;br /&gt;
     id: canvas&lt;br /&gt;
     width: 200&lt;br /&gt;
     height: 200&lt;br /&gt;
     color: &amp;quot;blue&amp;quot;&lt;br /&gt;
&lt;br /&gt;
     Image {&lt;br /&gt;
         id: logo&lt;br /&gt;
         source: &amp;quot;pics/logo.png&amp;quot;&lt;br /&gt;
         anchors.centerIn: parent&lt;br /&gt;
         x: canvas.height / 5      &lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 動畫 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;qml&amp;quot;&amp;gt;&lt;br /&gt;
 Rectangle {&lt;br /&gt;
     id: rect&lt;br /&gt;
     width: 120; height: 200&lt;br /&gt;
&lt;br /&gt;
     Image {&lt;br /&gt;
         id: img&lt;br /&gt;
         source: &amp;quot;pics/qt.png&amp;quot;&lt;br /&gt;
         x: 60 - img.width/2&lt;br /&gt;
         y: 0&lt;br /&gt;
&lt;br /&gt;
         SequentialAnimation on y {&lt;br /&gt;
             loops: Animation.Infinite&lt;br /&gt;
             NumberAnimation { to: 200 - img.height; easing.type: Easing.OutBounce; duration: 2000 }&lt;br /&gt;
             PauseAnimation { duration: 1000 }&lt;br /&gt;
             NumberAnimation { to: 0; easing.type: Easing.OutQuad; duration: 1000 }&lt;br /&gt;
         }&lt;br /&gt;
     }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Qt/C++ 整合 ==&lt;br /&gt;
QML 不需要 Qt/C++ 的知識就能使用，但它可以輕鬆地擴展 Qt。&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;熟悉的概念&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
QML 提供直接訪問，從以下來自 Qt 的概念：&lt;br /&gt;
* QAction&amp;amp;nbsp;– action 類型&lt;br /&gt;
* QObject signals and slots&amp;amp;nbsp;– 作為在 JavaScript 中調用的函數&lt;br /&gt;
* QObject properties&amp;amp;nbsp;– 作為 JavaScript 中的變數&lt;br /&gt;
* QWidget&amp;amp;nbsp;– QDeclarativeView 是一個 QML-displaying widget&lt;br /&gt;
* Q*Model&amp;amp;nbsp;– 直接用在資料綁定 (如 QAbstractItemModel)&lt;br /&gt;
	&lt;br /&gt;
=== Qt 信號處理式 ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
 MouseArea {&lt;br /&gt;
     onPressed: console.log(&amp;quot;mouse button pressed&amp;quot;)&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== 操作方法===&lt;br /&gt;
* [https://web.archive.org/web/20100819130735/http://wiki.forum.nokia.com/index.php/CS001613_-_Calling_Qt_class_methods_from_QML Calling Qt class methods from QML]&lt;br /&gt;
* [https://web.archive.org/web/20100819160752/http://wiki.forum.nokia.com/index.php/CS001627_-_Creating_a_custom_QML_element_with_Qt Creating a custom QML element with Qt]&lt;br /&gt;
* [https://web.archive.org/web/20101211113715/http://wiki.forum.nokia.com/index.php/CS001625_-_Connecting_Qt_signal_to_QML_function Connecting Qt signal to QML function]&lt;br /&gt;
&lt;br /&gt;
== 開發工具 ==&lt;br /&gt;
由于 QML 和 Javascript 的语法相似，大多数支持 Javascript 的编辑器均可编辑 QML。但是从 [[Qt Creator]] 的 2.1 版本开始，该 IDE 提供了完整的语法高亮、代码补全、内建帮助和所见即所得编辑器。在商业版本的 Creator 中，所见即所得编辑器还会提供更多的功能。&lt;br /&gt;
&lt;br /&gt;
== 參考資料 ==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
== 外部連結 ==&lt;br /&gt;
* [https://web.archive.org/web/20111024202714/http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeelements.html QML Reference Documentation]&lt;br /&gt;
* [https://web.archive.org/web/20111014054245/http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeintroduction.html Introduction to the QML language]&lt;br /&gt;
* [https://web.archive.org/web/20111008153849/http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeexamples.html QML Examples and Demos]&lt;br /&gt;
* [https://web.archive.org/web/20090518012534/http://labs.trolltech.com/blogs/category/labs/graphics/kinetic/declarative_ui/ Qt Labs Blog Posts related to QML]&lt;br /&gt;
* [https://web.archive.org/web/20100924210913/http://doc.qt.nokia.com/4.7/qml-tutorial.html QML Tutorial]&lt;br /&gt;
&lt;br /&gt;
{{Qt}}&lt;br /&gt;
&lt;br /&gt;
[[Category:Qt]]&lt;br /&gt;
[[Category:宣告式編程語言]]&lt;/div&gt;</summary>
		<author><name>imported&gt;SchlurcherBot</name></author>
	</entry>
</feed>