QDBusAbstractInterface Class
The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the Qt D-Bus binding, allowing access to remote interfaces. More...
Header: | #include <QDBusAbstractInterface> |
qmake: | QT += dbus |
Since: | Qt 4.2 |
Inherits: | QObject |
Inherited By: |
This class was introduced in Qt 4.2.
Public Functions
virtual | ~QDBusAbstractInterface() |
QDBusPendingCall | asyncCallWithArgumentList(const QString &method, const QList<QVariant> &args) |
QDBusMessage | callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList<QVariant> &args) |
bool | callWithCallback(const QString &method, const QList<QVariant> &args, QObject *receiver, const char *returnMethod, const char *errorMethod) |
bool | callWithCallback(const QString &method, const QList<QVariant> &args, QObject *receiver, const char *slot) |
QDBusConnection | connection() const |
QString | interface() const |
bool | isValid() const |
QDBusError | lastError() const |
QString | path() const |
QString | service() const |
void | setTimeout(int timeout) |
int | timeout() const |
Detailed Description
Generated-code classes also derive from QDBusAbstractInterface, all methods described here are also valid for generated-code classes. In addition to those described here, generated-code classes provide member functions for the remote methods, which allow for compile-time checking of the correct parameters and return values, as well as property type-matching and signal parameter-matching.
See also The QDBus compiler and QDBusInterface.
Member Function Documentation
[virtual]
QDBusAbstractInterface::~QDBusAbstractInterface()
Releases this object's resources.
QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(const QString &method, const QList<QVariant> &args)
Places a call to the remote method specified by method on this interface, using args as arguments. This function returns a QDBusPendingCall object that can be used to track the status of the reply and access its contents once it has arrived.
Normally, you should place calls using asyncCall().
Note: This function is thread-safe.
This function was introduced in Qt 4.5.
QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode, const QString &method, const QList<QVariant> &args)
Places a call to the remote method specified by method on this interface, using args as arguments. This function returns the message that was received as a reply, which can be a normal QDBusMessage::ReplyMessage (indicating success) or QDBusMessage::ErrorMessage (if the call failed). The mode parameter specifies how this call should be placed.
If the call succeeds, lastError() will be cleared; otherwise, it will contain the error this call produced.
Normally, you should place calls using call().
Warning: If you use UseEventLoop
, your code must be prepared to deal with any reentrancy: other method calls and signals may be delivered before this function returns, as well as other Qt queued signals and events.
Note: This function is thread-safe.
bool QDBusAbstractInterface::callWithCallback(const QString &method, const QList<QVariant> &args, QObject *receiver, const char *returnMethod, const char *errorMethod)
Places a call to the remote method specified by method on this interface, using args as arguments. This function returns immediately after queueing the call. The reply from the remote function is delivered to the returnMethod on object receiver. If an error occurs, the errorMethod on object receiver is called instead.
This function returns true
if the queueing succeeds. It does not indicate that the executed call succeeded. If it fails, the errorMethod is called. If the queueing failed, this function returns false
and no slot will be called.
The returnMethod must have as its parameters the types returned by the function call. Optionally, it may have a QDBusMessage parameter as its last or only parameter. The errorMethod must have a QDBusError as its only parameter.
This function was introduced in Qt 4.3.
See also QDBusError and QDBusMessage.
bool QDBusAbstractInterface::callWithCallback(const QString &method, const QList<QVariant> &args, QObject *receiver, const char *slot)
This is an overloaded function.
This function is deprecated. Please use the overloaded version.
Places a call to the remote method specified by method on this interface, using args as arguments. This function returns immediately after queueing the call. The reply from the remote function or any errors emitted by it are delivered to the slot slot on object receiver.
This function returns true
if the queueing succeeded: it does not indicate that the call succeeded. If it failed, the slot will be called with an error message. lastError() will not be set under those circumstances.
See also QDBusError and QDBusMessage.
QDBusConnection QDBusAbstractInterface::connection() const
Returns the connection this interface is associated with.
QString QDBusAbstractInterface::interface() const
Returns the name of this interface.
bool QDBusAbstractInterface::isValid() const
Returns true
if this is a valid reference to a remote object. It returns false
if there was an error during the creation of this interface (for instance, if the remote application does not exist).
Note: when dealing with remote objects, it is not always possible to determine if it exists when creating a QDBusInterface.
QDBusError QDBusAbstractInterface::lastError() const
Returns the error the last operation produced, or an invalid error if the last operation did not produce an error.
QString QDBusAbstractInterface::path() const
Returns the object path that this interface is associated with.
QString QDBusAbstractInterface::service() const
Returns the name of the service this interface is associated with.
void QDBusAbstractInterface::setTimeout(int timeout)
Sets the timeout in milliseconds for all future DBus calls to timeout. -1 means the default DBus timeout (usually 25 seconds).
This function was introduced in Qt 4.8.
See also timeout().
int QDBusAbstractInterface::timeout() const
Returns the current value of the timeout in milliseconds. -1 means the default DBus timeout (usually 25 seconds).
This function was introduced in Qt 4.8.
See also setTimeout().
© 2020 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.