QDBusServer Class
QDBusServer 类支持同一台计算机上不同进程之间的点对点通信。更多内容...
| 头文件: | #include <QDBusServer> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS DBus) target_link_libraries(mytarget PRIVATE Qt6::DBus) |
| qmake: | QT += dbus |
| 继承自: | QObject |
公共函数
| QDBusServer(QObject *parent = nullptr) | |
| QDBusServer(const QString &address, QObject *parent = nullptr) | |
| virtual | ~QDBusServer() |
| QString | address() const |
| bool | isAnonymousAuthenticationAllowed() const |
| bool | isConnected() const |
| QDBusError | lastError() const |
| void | setAnonymousAuthenticationAllowed(bool value) |
信号
| void | newConnection(const QDBusConnection &connection) |
成员函数文档
[explicit] QDBusServer::QDBusServer(QObject *parent = nullptr)
使用给定的parent 实例构建一个QDBusServer。该服务器将在/tmp (在Unix系统上)或绑定到localhost的TCP端口(在其他系统上)上监听连接。
[explicit] QDBusServer::QDBusServer(const QString &address, QObject *parent = nullptr)
使用给定的address 和parent 创建一个QDBusServer。
[virtual noexcept] QDBusServer::~QDBusServer()
摧毁一个QDBusServer
QString QDBusServer::address() const
返回与该服务器关联的地址。
bool QDBusServer::isAnonymousAuthenticationAllowed() const
如果允许匿名认证,则返回 true。
另请参阅 setAnonymousAuthenticationAllowed()。
bool QDBusServer::isConnected() const
如果该QDBusServer 对象已连接,则返回true 。
如果未连接,则需要再次调用构造函数。
QDBusError QDBusServer::lastError() const
返回该服务器中发生的最后一个错误。
此函数专为低级代码提供。
[signal] void QDBusServer::newConnection(const QDBusConnection &connection)
当与服务器建立新的客户端连接connection 时,会发出此信号。
void QDBusServer::setAnonymousAuthenticationAllowed(bool value)
如果将 `value ` 设置为 `true`,即使连接的客户端未通过用户身份验证,传入连接仍可继续。
默认情况下,此值为 false。
另请参阅 isAnonymousAuthenticationAllowed()。
© 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.