Qt D-Bus

D-Bus is an Inter-Process Communication (IPC) and Remote Procedure Calling (RPC) mechanism originally developed for Linux to replace existing and competing IPC solutions with one unified protocol. It was also designed to allow communication between system-level processes (such as printer and hardware driver services) and normal user processes.

它使用快速的二进制消息传递协议,适于同机通信 (由于它的低潜伏时间和低开销)。目前,其规范的定义由 freedesktop.org project and is available to all parties.

Communication, in general, happens through a central server application called the "bus" (hence the name), but direct application-to-application communication is also possible. When communicating on a bus, applications can query which other applications and services are available, as well as activate one on demand.

使用模块

使用 Qt 模块的 C++ API 要求直接 (或透过其它依赖) 链接到模块库。几个构建工具对此有专用支持,包括 CMake and qmake .

使用 find_package() 命令定位所需模块组件在 Qt6 包:

find_package(Qt6 REQUIRED COMPONENTS DBus)
target_link_libraries(mytarget PRIVATE Qt6::DBus)
					

更多细节,见 构建采用 CMake 概述。

文章和指南

The following documents contain information about Qt's D-Bus integration features and provide details about the mechanisms used to send and receive type information over the bus:

范例

参考

模块演变

Qt D-Bus 的变化 列出了 Qt 的 Qt 6 系列在模块 API 和功能上所做出的重要改变。

许可和归属

Qt D-Bus 模块在商业许可下是可用的来自 Qt 公司 。此外,它在自由软件许可下也是可用的: GNU LGPL (次一般公共许可) 第 3 版 ,或 GNU GPL (一般公共许可) 第 2 版 。见 Qt 许可 进一步了解细节。

Furthermore, Qt D-Bus in Qt 6.5.1 may contain third party modules under the following permissive licenses:

libdus-1 头,dbus 第 1.13.12 版 学术免费许可第 2.1 版,或 GNU GPL (一般公共许可) 第 2.0 版或更高版本