Qt Widgets 示例

各种小工具图库

Qt 提供了种类繁多的标准控件,这些正是现代应用程序用户所期望的。

您还可以开发自己的自定义小部件和控件,并与标准小部件一起使用。

甚至还可以为小部件提供自定义样式和主题,用于更改标准小部件以及编写得当的自定义小部件的外观。

Analog Clock

“模拟时钟”示例展示了如何绘制自定义小部件的内容。

Calculator Example

该示例展示了如何使用信号和槽来实现计算器小部件的功能,以及如何使用 QGridLayout 将子小部件放置在网格中。

Calendar Widget Example

“日历小部件”示例展示了如何使用 QCalendarWidget。

Cube RHI Widget Example

演示了如何使用 Qt 3D API 和着色语言抽象层 QRhi 来渲染带纹理的立方体,并将其与 QPainter 和 Qt Widgets 集成。

Document Viewer

一个用于显示和打印 JSON、文本和 PDF 文件的控件应用程序

Line Edits Example

“行编辑”示例演示了 QLineEdit 的多种用法,并展示了各种属性和验证器对用户提供的输入和输出的影响。

Scribble Example

“Scribble”示例展示了如何重写 QWidget 的一些事件处理程序,以接收为应用程序小部件生成的事件。

Shortcut Editor Example

“快捷键编辑器”示例展示了如何创建一个基本的、可读写的层次模型,以配合 Qt 的标准视图和 QKeySequenceEdit 类使用。有关模型/视图编程的描述,请参阅模型/视图编程概述。

Simple RHI Widget Example

演示了如何使用 QRhi(Qt 3D API 和着色语言抽象层)渲染一个三角形。

Sliders Example

“滑块”示例演示了如何使用 Qt 中提供的各种类型的滑块:QSlider、QScrollBar 和 QDial。

Spin Boxes Example

“旋转框”示例演示了如何使用 Qt 中提供的多种不同类型的旋转框,从简单的 QSpinBox 控件到更复杂的编辑器(如 QDateTimeEdit 控件)。

System Tray Icon Example

“系统托盘图标”示例演示了如何将一个带有菜单和弹出消息的图标添加到桌面环境的系统托盘中。

Translucent Background

该示例演示了如何制作一个具有半透明背景的圆形窗口。

Widgets Gallery Example

“控件图库”示例展示了与 UI 设计相关的控件。

Window Flags Example

“窗口标志”示例展示了如何使用 Qt 中提供的窗口标志。

Window Hosting Example

演示如何在 Qt 应用程序中托管非 Qt UI 元素

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.