Qt 范例和教程
Qt 提供一批代码样本和教程,以帮助新用户入门 Qt 开发。这些文档涵盖一系列话题、从 Widget 的基本用法到分步教程,以展示如何把应用程序拼凑在一起。
范例是 Qt 包的一部分。请拜访
下载
页面,了解更多信息。
运行范例
打开和运行范例在 Qt Creator
欢迎
模式。大多数范例可在各平台上运行且可搜索特定平台范例,在搜索字段中键入平台名称 (或任何关键字)。例如,键入
Android
在搜索字段中列表完全兼容 Android 的范例。
有关在 Qt Creator 中运行范例的更多信息,拜访
构建和运行范例
页面。
要查看所有 Qt 范例的列表,请拜访
Qt 范例列表
页面。
应用程序范例
Calqlatr
|
A Qt Quick app designed for portrait devices that uses custom components, animated with AnimationController, and JavaScript for the application logic.
|
咖啡机
|
具有基于状态的自定义用户界面的 Qt Quick 应用程序。
|
文档查看器
|
A Widgets application to display and print Json, text and PDF files. Demonstrates various features to use in widget applications: Using QSettings, query and save user preferences, manage file histories and control cursor behavior when hovering over widgets.
|
照片表面
|
A QML app for touch devices that uses a Repeater with a FolderListModel to access content in a folder, and a PinchHandler to handle pinch gestures on the fetched content.
|
食谱浏览器
|
Injecting custom stylsheets into web pages and providing a rich text preview tool for a custom markup language
|
连接
注解 URL (统一资源定位符)
|
Example shows reading from formatted NFC Data Exchange Format (NDEF) messages
|
Blocking Receiver
|
Shows how to use the synchronous API of QSerialPort in a non-GUI thread
|
Blocking Sender
|
Shows how to use the synchronous API of QSerialPort in a worker thread
|
蓝牙聊天
|
Shows communication through Bluetooth using RFCOMM protocol
|
Bluetooth Low Energy Heart Rate Game
|
A game demonstrating the interaction with a Bluetooth Low Energy Heart Rate device/service
|
Bluetooth Low Energy Heart Rate Server
|
An example demonstrating how to set up and advertise a GATT service. The example demonstrates the use of the Qt Bluetooth Low Energy classes related to peripheral (slave) functionality
|
Bluetooth Low Energy Scanner
|
An application designed to browse the content of Bluetooth Low Energy peripheral devices. The example demonstrates the use of all Qt Bluetooth Low Energy classes
|
CAN 总线管理器
|
Example sends and receives CAN bus frames
|
Modbus Client
|
Example implements a Modbus client application
|
Modbus 自定义命令
|
Example shows how to handle custom Modbus function codes
|
Modbus 服务器
|
Example implements a Modbus server application
|
Serial Terminal
|
Shows how to use various features of QSerialPort
|
桌面
计算器构建器
|
Creating a user interface from a Qt Designer form at run-time
|
计算器表单
|
在应用程序中使用采用 Qt Designer 创建的表单
|
计算器表单/多继承
|
在应用程序中使用采用 Qt Designer 创建的表单
|
容器扩展范例
|
Creating a custom multi-page plugin for Qt Designer
|
自定义 Widget 插件
|
Creating a custom widget plugin for Qt Designer
|
任务菜单扩展
|
Creating a custom widget plugin for Qt Designer and providing custom task menu entries that are associated with the plugin
|
文本查找器
|
Dynamically loading .ui files using QUiLoader
|
嵌入式
自定义 Shell
|
Custom Shell shows how to implement a custom shell extension
|
IVI Compositor
|
IVI Compositor is an example that demonstrates how to use the IviApplication extension
|
Minimal QML
|
Minimal QML is a simple example that demonstrates how to write a Wayland compositor in QML
|
Multi Output
|
Multi Output is an example that demonstrates a compositor with multiple outputs
|
Multi Screen
|
Multi Screen is a desktop-style Wayland compositor for multiple screens
|
Overview Compositor
|
Overview Compositor shows how to switch between clients in a grid
|
Pure QML
|
Pure QML is an example that demonstrates how to write a Wayland compositor in pure QML
|
QtShell Compositor
|
QtShell Compositor shows how to use the QtShell shell extension
|
Server Side Decoration Compositor
|
Server Side Decoration Compositor is a simple example that demonstrates server side window decorations on xdg-shell
|
Spanning Screens
|
Spanning Screens is an example that demonstrates how to let Wayland clients span multiple screens
|
图形
指针式时钟
|
Analog Clock example shows how to draw the contents of a custom widget
|
Axis Handling
|
Implementing axis dragging with a custom input handler in QML, and creating a custom axis formatter
|
图形图库
|
Gallery of Bar, Scatter, and Surface graphs
|
Simple Bar Graph
|
Using Bars3D in a QML application
|
Simple Scatter Graph
|
Using Scatter3D in a QML application
|
Surface Graph Gallery
|
Gallery with three different ways to use a Surface3D graph
|
体积渲染
|
Rendering volumetric objects
|
Wiggly
|
Demonstrates how to use an effect created with the Qt Quick Effect Maker (QQEM)
|
国际化
移动
网络
位置 & 定位
Log File Position Source (C++)
|
Logfile Position Source shows how to create and work with a custom position source. It can be useful for simulating GPS data, or when the data is received in some custom format
|
SatelliteInfo (QML)
|
SatelliteInfo example shows the available satellites using Sky View or RSSI View and the user's current position. The satellites currently contributing to the GPS fix are marked as pink
|
Weather Info (C++/QML)
|
Weather Info example shows how to use the user's current position to retrieve local content from a web service in a C++ plugin for QML
|
要查看和运行由 Qt 工程提供的范例,拜访
社区范例
页面。
所有范例
所有 Qt 范例
列出了按其所属 Qt 模块分类的所有范例。