QML Applications
QML是一个声明性语言, 使用视觉组件及组件间的相互交互和关联描述用户界面. 它是一个可读性很强的语言, 使组件以动态方式互连, 可以轻松重用和定制组件. 使用 QtQuick
模块, 设计师和开发人员可以轻松地在QML中构建流程的动画用户界面, 并将其连接到任意的C++后端库.
什么是 QML?
QML是一个用户界面规范和编程语言. 它允许开发人员和设计师创建具备高性能, 流畅动画, 美丽视觉的应用程序. QML提供一个可读性强, 类似JSON语法, 支持结合动态属性绑定的命令式JavaScript表达式.
Qt QML 模块提供QML语言和基础引擎. 详见 Qt QML.
- First Steps with QML - begin using QML with these examples
- Creating Qt Quick Projects in Qt Creator
- The QML Reference - reference about the QML constructs and features
- QML Coding Conventions
- Glossary of QML Terms
什么是 Qt Quick?
Qt Quick是QML类型和功能的标准库. 它包含视觉类型, 交互类型, 动画, 模型和视图, 粒子效果和着色器效果. QML开发人员通过导入语句访问这些功能.
有关QML类型和功能, 详见 Qt Quick模块.
QML用户界面
为了创建或自定义用户界面, 除了基本类型外, Qt Quick还添加视觉类型, 动画类型和其他类型. Qt Quick Designer集成在Qt Creator中, Qt Creator 2.7及后续版本支持QtQuick 2
.
- Visual types in QML
- Responding to User Input in QML
- Animations in QML
- Displaying Text in QML
- Layouts in QML
- Style and Theme Support
- Integrating JavaScript in QML
- Scalability
按钮, 菜单和其他控件
For a set of basic UI controls, the Qt Quick Controls module implements several controls such as buttons, menus, and views. These controls mimic the native behavior found in different platforms such as Windows, macOS, and Linux.
A second set of UI controls, Qt Quick Controls 2, was designed for use on embedded systems, where the hardware has limited resources. For a comparison of the two sets of controls, see Differences between Qt Quick Controls.
Special Effects
Several Qt modules provide types for creating special effects in applications. Their respective pages contain more information about specific uses.
- Particle Effects
- Graphical Effects - for creating image composition effects.
Viewing Web Content in QML Applications
The QML types, WebEngineView and WebView, render and display dynamic web content. The only difference between the two is that the latter uses a native web view if available. Both these types can load a URL or an HTML string. To read more about them and view code samples, see Qt WebEngine and Qt WebView.
Sensors, Gestures, and Touch Interfaces
The Qt Sensors module allows applications to read information from sensors such as accelerometers and tilt sensors. There is a common QML API for different platforms and can be extended in C++.
- Qt Sensors QML Types
- Qt Sensors Examples
- Compatibility Map - lists support level for different mobile platforms
Multimedia Content
The Qt Multimedia module enables applications to handle various media content with a convenient set of QML types. These QML types can be extended in C++.
- Multimedia
- Audio Overview
- Video Overview
- Camera Overview
- Radio Overview
- Qt Audio Engine - for 3D positional audio playback and content management.
Mobile Devices
Several Qt modules provide QML APIs for networked and mobile devices. The QML types provide access to the Bluetooth, Near-Field Communications (NFC), and GPS-enabled devices.
For more information, visit the Networking and Connectivity and Mobile APIs pages.
Code Samples and Demos
To learn more about uses of QML code, there are several code samples which show how QML types are used. In addition, there are several demos which show how QML code is used in applications.
- Getting Started Programming with Qt Quick - a tutorial showing the creation of a simple QML text editor.
- Qt Quick Examples and Tutorials
Advanced Application Development Topics
- Integrating QML and C++
- Deploying QML Applications
- Performance Considerations and Suggestions
- Internationalization and Localization
- Testing and Debugging
Other QML Modules
Qt Quick only provides basic visual types and much of Qt's functionality is exposed to QML through other modules. If you require the functionality of those modules, you should browse their QML documentation.
The All QML APIs by Module contains a list of all QML modules in Qt 5.