Qt Widgets 示例

Qt 提供了大量现代应用程序用户所期待的标准部件。

您还可以开发自己的自定义 widget 和控件,并将它们与标准 widget 结合使用。

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

Analog Clock

模拟时钟示例展示了如何绘制自定义 widget 的内容。

Calculator Example

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

Calendar Widget Example

日历部件示例展示了 QCalendarWidget 的使用。

Cube RHI Widget Example

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

Document Viewer

显示和打印 JSON、文本和 PDF 文件的 Widgets 应用程序

Line Edits Example

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

Scribble Example

Scribble 示例展示了如何重新实现 QWidget 的某些事件处理程序,以接收为应用程序部件生成的事件。

Shortcut Editor Example

快捷键编辑器(Shortcut Editor)示例展示了如何创建一个基本的读写分层模型,与 Qt 的标准视图和 QKeySequenceEdit 类一起使用。有关模型/视图编程的说明,请参阅模型/视图编程概述。

Simple RHI Widget Example

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

Sliders Example

滑块示例展示了如何使用 Qt 中不同类型的滑块:QSlider、QScrollBar 和 QDial。

Spin Boxes Example

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

System Tray Icon Example

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

Tablet Example

该示例展示了如何在 Qt 应用程序中使用 Wacom 手写板。

Translucent Background

该示例展示了如何制作半透明背景的圆形窗口。

Widgets Gallery Example

Widgets Gallery 示例展示了与用户界面设计相关的 widgets。

Window Embedding

演示如何在 Qt 应用程序中嵌入非 Qt UI 元素

Window Flags Example

窗口标志示例展示了如何使用 Qt 中可用的窗口标志。

© 2025 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.