Qt Widgets 范例

Qt 带有现代应用程序用户,所期望的大量标准 Widget。

还可以开发自己的自定义 Widget 和控件,并使用它们与标准 Widget 一起。

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

指针式时钟范例

指针式时钟范例展示如何绘制自定义 Widget 的内容。

计算器范例

范例展示如何使用信号/槽来实现计算器 Widget 功能,及如何使用 QGridLayout 将子级小部件放在栅格中。

日历 Widget 范例

日历 Widget 范例展示使用 QCalendarWidget。

字符映射范例

字符映射范例展示如何创建既可以显示自身内容,又可以响应用户输入的自定义 Widget。

代码编辑器范例

代码编辑器范例展示如何创建拥有行号和突显当前行的简单编辑器。

数字时钟范例

数字时钟范例展示如何使用 QLCDNumber 显示具有类似 LCD 数字的数。

组框范例

组框范例展示如何在 Qt 中使用不同种类的组框。

图标范例

图标范例展示 QIcon 如何生成反射图标状态、模式及大小的像素图。

图像查看器范例

范例展示如何组合 QLabel 和 QScrollArea 以显示图像。

行编辑范例

The Line Edits example demonstrates the many ways that QLineEdit can be used, and shows the effects of various properties and validators on the input and output supplied by the user.

影片范例

The Movie example demonstrates how to use QMovie and QLabel to display animations.

涂鸦范例

The Scribble example shows how to reimplement some of QWidget's event handlers to receive the events generated for the application's widgets.

异形时钟范例

The Shaped Clock example shows how to apply a widget mask to a top-level widget to produce a shaped window.

滑块范例

The Sliders example shows how to use the different types of sliders available in Qt: QSlider, QScrollBar and QDial.

自旋框范例

The Spin Boxes example shows how to use the many different types of spin boxes available in Qt, from a simple QSpinBox widget to more complex editors like the QDateTimeEdit widget.

样式表范例

样式表范例展示如何使用样式表。

样式范例

Styles 范例阐明如何使用 Qt 创建自定义 Widget 绘制样式,和演示 Qt 的预定义样式。

系统托盘图标范例

The System Tray Icon example shows how to add an icon with a menu and popup messages to a desktop environment's system tray.

数位板范例

此范例展示如何在 Qt 应用程序中使用 Wacom 数位板。

俄罗斯方块范例

俄罗斯方块范例是经典俄罗斯方块游戏的 Qt 版本。

工具提示范例

工具提示范例展示如何为应用程序 Widget 提供静态和动态工具提示。

摆动范例

The Wiggly example shows how to animate a widget using QBasicTimer and timerEvent(). In addition, the example demonstrates how to use QFontMetrics to determine the size of text on screen.

窗口标志范例

窗口标志范例展示如何使用可用于 Qt 的窗口标志。