Qt features multiple technologies for creating user interfaces. While it is possible to mix and match these different technologies as needed, one approach is often better suitable for a certain type of user interface than the others. Qt Creator is a good example of an application that combines traditional Qt Widgets with Qt Quick . Widgets form the basis of the user interface, whereas Qt Quick is used to implement the Welcome mode, for example. The following sections provide brief introductions to the available technologies for creating user interfaces, and a comparison table to help choosing the best suitable technology.
QML allows developers to build user interfaces in a declarative way. User interfaces specifically benefit from the simplicity of compounding QML objects and configuring them using property bindings.
Qt Quick is a module which supplies QML types for creating user interfaces such as a visual canvas with its own coordinate system and rendering engine. Animation and transition effects are a first class concept in Qt Quick and visual effects can be supplemented through specialized components for particle and shader effects.
Qt Quick Controls module (since Qt 5.1) provides a set of UI elements to create user interfaces for desktop and mobile platforms using Qt Quick 2. The Qt Quick Controls 2 module (since Qt 5.7) provides lightweight QML types for creating performant user interfaces for embedded and mobile devices. These controls achieve improved efficiency by employing a simplified styling architecture when compared to the first set of controls. For a comparison of the two sets of controls, see Differences between Qt Quick Controls .
For more about how to create application user interfaces with QML, visit the QML 用户界面 页面。
Qt Widgets are traditional user interface elements that are typically found in desktop environments. The widgets integrate well to the underlying platform providing native look'n'feel on Windows, Linux and Mac OSX. The widgets are mature and feature rich user interface elements suitable for mostly static user interfaces. In contrast to Qt Quick , the widgets do not scale that well for touch screens and fluid, highly animated modern user interfaces. The widgets are a good choice for applications with traditional desktop centric user interfaces, such as office type applications.
Qt provides ready-made C++ classes and QML types for visualizing data in the form of charts and graphs, which are known to be best ways of analyzing data. Qt Charts and Qt Data Visualization are the two Qt add-ons that make data visualization using 2D and 3D models a reality.
Qt 提供基于 Chromium 的 WebEngine layout engine, which enables you to embed web content into the Qt application. The engine can be integrated into both Qt Widget-based and Qt Quick-based applications.
有关在 Qt 中支持 Web 内容的更多信息，见 集成 Web 内容 .
Choosing the appropriate technology for building a user interface is not always easy. It depends on several variables, such as other technologies used in a project or target platform constraints. To some extent, many items in the following table can be implemented using any of the three available technologies. The following table aims to help you choose the tool best suited for the job.
|Qt Quick / Qt Quick Controls||Qt Widgets||Qt WebEngine||注释|
|本机外观和感觉||Qt Widgets and Qt Quick Controls integrate well to the underlying platform, providing a native look'n'feel on Windows, Linux, and macOS.|
|自定义外观和感觉||Qt Widgets provide means for customization via style sheets, but Qt Quick is a better performing choice for user interfaces that do not aim to look native.|
|Fluid animated UIs||Qt Widgets do not scale well for animations. Qt Quick offers a convenient and natural way to implement animations in a declarative manner.|
|触摸屏||Qt Widgets often require a mouse cursor for good interaction, whereas Qt Quick only provides primitive building blocks that were designed with touch interaction in mind. The WebView Qt Quick component has support for multi-touch gestures to interact with web content.|
|标准工业 Widget||Qt Widgets provide all the bells and whistles, developed over two decades, needed for building standard industry type applications. Qt WebEngine Widgets provide widgets and additional classes to render and interact with web content.|
|模型/视图编程||Qt Quick provides convenient views, but Qt Widgets provide more convenient and complete framework. In addition to Qt Quick views, Qt Quick Controls provide a TableView .|
|敏捷 UI 开发||Qt Quick 是敏捷 UI 原型设计和开发的绝佳抉择。|
|HW (硬件) 加速图形||Qt Widgets provide QGLWidget for rendering OpenGL graphics, and Qt WebEngine supports WebGL, but the OpenGL ES 2.0 or OpenGL 2.0 based Qt Quick Scene Graph has proven to provide the best performance for UIs and for integrating with OpenGL content.|
|图形效果||The particle system and shader effects available in Qt Quick are more flexible. Qt Widgets offer very little in this area.|
|富文本处理||Qt Widgets currently provide the most comprehensive base for implementing text editors. Qt's rich text document classes can also be utilized in Qt Quick and Qt Quick Controls' TextArea , but may require some C++ implementation.|
|现有 Web 内容||Both Qt Quick and Qt Widgets provide components for presenting 简单富文本 , but Qt WebEngine is the best choice for presenting full-blown web content.|
Qt 为把应用程序翻译成本地语言提供了出色的支持。发行经理、翻译者及开发者可以使用 Qt 翻译工具以完成其任务。