QDBusServer Class
QDBusServer 类为同一台计算机上的进程提供点对点通信。更多
Header: | #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()。
© 2025 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.