QDBusVirtualObject 类用于采用一个类处理多个 DBus 路径。 更多...
头: | #include <QDBusVirtualObject> |
CMake: |
find_package(Qt6 REQUIRED COMPONENTS DBus)
target_link_libraries(mytarget PRIVATE Qt6::DBus) |
qmake: | QT += dbus |
继承: | QObject |
QDBusVirtualObject (QObject * parent = nullptr) | |
virtual | ~QDBusVirtualObject () |
virtual bool | handleMessage (const QDBusMessage & message , const QDBusConnection & connection ) = 0 |
virtual QString | introspect (const QString & path ) const = 0 |
[explicit]
QDBusVirtualObject::
QDBusVirtualObject
(
QObject
*
parent
= nullptr)
构造 QDBusVirtualObject 采用 parent .
[virtual noexcept]
QDBusVirtualObject::
~QDBusVirtualObject
()
销毁对象,删除其所有子级对象。
[pure virtual]
bool
QDBusVirtualObject::
handleMessage
(const
QDBusMessage
&
message
, const
QDBusConnection
&
connection
)
This function needs to handle all messages to the path of the virtual object, when the SubPath option is specified. The service, path, interface and methods are all part of the
message
. Parameter
connection
is the connection handle. Must return
true
when the message is handled, otherwise
false
(will generate dbus error message).
[pure virtual]
QString
QDBusVirtualObject::
introspect
(const
QString
&
path
) const
This function needs to handle the introspection of the virtual object on path . It must return xml of the form:
<interface name="org.qtproject.QtDBus.MyObject" > <property access="readwrite" type="i" name="prop1" /> </interface>
If you pass the SubPath option, this introspection has to include all child nodes. Otherwise QDBus handles the introspection of the child nodes.