本页内容

D-Bus 复杂来回调用

演示了Qt D-Bus 类型系统的使用方法。

“复杂来回”示例演示了 Qt D-BusQDBusVariant 和QDBusReply 的类型系统。该示例由主应用程序complexping 组成,该程序会启动另一个应用程序complexpong 。输入诸如hello 和ping 等关键词时,由complexpong进行处理,并将回复打印到标准输出。

运行示例

您可以通过以下方式运行该示例:

要运行,请执行complexping 应用程序。

$ ./complexping
Ask your question: When is the next Qt release?
Reply was: Sorry, I don't know the answer
Ask your question: What is the answer to life, the universe and everything?
Reply was: 42

示例项目 @ code.qt.io

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