用户界面

Qt 框架的主要用户界面技术是 Qt Quick Controls and Qt Widgets . Qt Quick Control interfaces are fluid, dynamic, and are best on touch interfaces. Qt Widgets are for creating complex desktop applications. You can create Qt Quick Controls and Qt Widgets interfaces with the target platform's native look and feel.

采用 Qt Quick Controls 构建 UI

Qt Quick Controls is for creating dynamic and fluid user interfaces. The Qt Quick Controls module supplies QML types such as buttons, dialogs, and menus. You can use QML, a declarative language, to build the UI and JavaScript to implement the logic.

下表包含相关概述:

Qt Widgets 用户界面

Qt Widgets are the user interface elements that are typical in desktop environments. The widgets integrate well to the underlying platform providing native look and feel on Windows, Linux and macOS. The widgets are mature and feature rich user interface elements suitable for mostly traditional user interfaces. In contrast to Qt Quick , the widgets are for creating large desktop applications and less suited for creating touch-centric applications with fluid interfaces.

以下列表包含 Qt Widgets 的相关概述:

UI 界面比较

下表比较 Qt Widgets 和 Qt Quick 界面。

Qt Quick / Qt Quick Controls Qt Widgets 注释
使用语言 QML/JS C++
本机外观和感觉 Qt Widgets and Qt Quick Controls support native look and feel on their target platforms.
自定义样式 Qt Widgets provide customization with style sheets and Qt Quick Controls has a selection of customizable styles .
流畅动画 UI Qt Widgets do not scale well for animations. Qt Quick Controls 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 Controls provides QML types for touch interaction.
标准工业 Widget Qt Widgets provide all the bells and whistles, developed over two decades, needed for building standard industry type applications.
模型/视图编程 Qt Quick 提供方便视图,但 Qt Widgets 提供更方便且完整的框架。除 Qt Quick 视图外,Qt Quick Controls 还提供 TableView .
敏捷 UI 开发 Qt Quick 是敏捷 UI 原型设计和开发的绝佳抉择。
HW (硬件) 加速图形 Qt provides full hardware acceleration for Qt Quick interfaces and Qt Widgets interfaces are rendered in software. The 图形 概述有更多信息。
图形效果 Several Qt Quick modules provide graphical effects and Qt Widgets interfaces can use Qt GUI for effects.
富文本处理 目前,Qt Widgets 为实现文本编辑器提供最综合基。Qt 的富文本文档类还可以用于 Qt Quick 和 Qt Quick Controls 的 TextArea ,但可能要求一些 C++ 实现。

The following pages contain more information about designing and developing user interfaces: