Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDBusAbstractInterface Class

TheQDBusAbstractInterface class is the base class for all D-Bus interfaces in theQtDBus binding, allowing access to remote interfacesMore...

Header:#include <QDBusAbstractInterface>
Since: Qt 4.2
Inherits:QObject
Inherited By:

QDBusConnectionInterface andQDBusInterface

Public Functions

virtual~QDBusAbstractInterface()
QDBusPendingCallasyncCall(const QString & method, const QVariant & arg1 = QVariant(), const QVariant & arg2 = QVariant(), const QVariant & arg3 = QVariant(), const QVariant & arg4 = QVariant(), const QVariant & arg5 = QVariant(), const QVariant & arg6 = QVariant(), const QVariant & arg7 = QVariant(), const QVariant & arg8 = QVariant())
QDBusPendingCallasyncCallWithArgumentList(const QString & method, const QList<QVariant> & args)
QDBusMessagecall(const QString & method, const QVariant & arg1 = QVariant(), const QVariant & arg2 = QVariant(), const QVariant & arg3 = QVariant(), const QVariant & arg4 = QVariant(), const QVariant & arg5 = QVariant(), const QVariant & arg6 = QVariant(), const QVariant & arg7 = QVariant(), const QVariant & arg8 = QVariant())
QDBusMessagecall(QDBus::CallMode mode, const QString & method, const QVariant & arg1 = QVariant(), const QVariant & arg2 = QVariant(), const QVariant & arg3 = QVariant(), const QVariant & arg4 = QVariant(), const QVariant & arg5 = QVariant(), const QVariant & arg6 = QVariant(), const QVariant & arg7 = QVariant(), const QVariant & arg8 = QVariant())
QDBusMessagecallWithArgumentList(QDBus::CallMode mode, const QString & method, const QList<QVariant> & args)
boolcallWithCallback(const QString & method, const QList<QVariant> & args, QObject * receiver, const char * returnMethod, const char * errorMethod)
boolcallWithCallback(const QString & method, const QList<QVariant> & args, QObject * receiver, const char * slot)
QDBusConnectionconnection() const
QStringinterface() const
boolisValid() const
QDBusErrorlastError() const
QStringpath() const
QStringservice() const
voidsetTimeout(int timeout)
inttimeout() const
  • 29 public functions inherited fromQObject

Additional Inherited Members

  • 1 property inherited fromQObject
  • 1 public slot inherited fromQObject
  • 1 signal inherited fromQObject
  • 7 static public members inherited fromQObject
  • 8 protected functions inherited fromQObject

Detailed Description

TheQDBusAbstractInterface class is the base class for all D-Bus interfaces in theQtDBus binding, allowing access to remote interfaces

Generated-code classes also derive fromQDBusAbstractInterface, 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 alsoThe QDBus compiler andQDBusInterface.

Member Function Documentation

[virtual]QDBusAbstractInterface::~QDBusAbstractInterface()

Releases this object's resources.

QDBusPendingCall QDBusAbstractInterface::asyncCall(constQString & method, constQVariant & arg1 = QVariant(), constQVariant & arg2 = QVariant(), constQVariant & arg3 = QVariant(), constQVariant & arg4 = QVariant(), constQVariant & arg5 = QVariant(), constQVariant & arg6 = QVariant(), constQVariant & arg7 = QVariant(), constQVariant & arg8 = QVariant())

Calls the methodmethod on this interface and passes the parameters to this function to the method.

The parameters tocall are passed on to the remote function via D-Bus as input arguments. The returnedQDBusPendingCall object can be used to find out information about the reply.

This function can be used with up to 8 parameters, passed in argumentsarg1,arg2,arg3,arg4,arg5,arg6,arg7 andarg8. If you need more than 8 parameters or if you have a variable number of parameters to be passed, useasyncCallWithArgumentList().

It can be used the following way:

QString value= retrieveValue();QDBusPendingCall pcall= interface->asyncCall(QLatin1String("Process"), value);QDBusPendingCallWatcher*watcher=newQDBusPendingCallWatcher(pcall,this);QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)),this, SLOT(callFinishedSlot(QDBusPendingCallWatcher*)));

This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to"ProcessWorkUnicode" will contain one Unicode string, the second call to"ProcessWork" will contain one string and one byte array).

This function was introduced in Qt 4.5.

QDBusPendingCall QDBusAbstractInterface::asyncCallWithArgumentList(constQString & method, constQList<QVariant> & args)

Places a call to the remote method specified bymethod on this interface, usingargs as arguments. This function returns aQDBusPendingCall 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 usingasyncCall().

Note: This function isthread-safe.

This function was introduced in Qt 4.5.

QDBusMessage QDBusAbstractInterface::call(constQString & method, constQVariant & arg1 = QVariant(), constQVariant & arg2 = QVariant(), constQVariant & arg3 = QVariant(), constQVariant & arg4 = QVariant(), constQVariant & arg5 = QVariant(), constQVariant & arg6 = QVariant(), constQVariant & arg7 = QVariant(), constQVariant & arg8 = QVariant())

Calls the methodmethod on this interface and passes the parameters to this function to the method.

The parameters tocall are passed on to the remote function via D-Bus as input arguments. Output arguments are returned in theQDBusMessage reply. If the reply is an error reply,lastError() will also be set to the contents of the error message.

This function can be used with up to 8 parameters, passed in argumentsarg1,arg2,arg3,arg4,arg5,arg6,arg7 andarg8. If you need more than 8 parameters or if you have a variable number of parameters to be passed, usecallWithArgumentList().

It can be used the following way:

QString value= retrieveValue();QDBusMessage reply;QDBusReply<int> api= interface->call(QLatin1String("GetAPIVersion"));if (api>=14)  reply= interface->call(QLatin1String("ProcessWorkUnicode"), value);else  reply= interface->call(QLatin1String("ProcessWork"), QLatin1String("UTF-8"), value.toUtf8());

This example illustrates function calling with 0, 1 and 2 parameters and illustrates different parameter types passed in each (the first call to"ProcessWorkUnicode" will contain one Unicode string, the second call to"ProcessWork" will contain one string and one byte array).

QDBusMessage QDBusAbstractInterface::call(QDBus::CallMode mode, constQString & method, constQVariant & arg1 = QVariant(), constQVariant & arg2 = QVariant(), constQVariant & arg3 = QVariant(), constQVariant & arg4 = QVariant(), constQVariant & arg5 = QVariant(), constQVariant & arg6 = QVariant(), constQVariant & arg7 = QVariant(), constQVariant & arg8 = QVariant())

This is an overloaded function.

Calls the methodmethod on this interface and passes the parameters to this function to the method. Ifmode isNoWaitForReply, then this function will return immediately after placing the call, without waiting for a reply from the remote method. Otherwise,mode indicates whether this function should activate the Qt Event Loop while waiting for the reply to arrive.

This function can be used with up to 8 parameters, passed in argumentsarg1,arg2,arg3,arg4,arg5,arg6,arg7 andarg8. If you need more than 8 parameters or if you have a variable number of parameters to be passed, usecallWithArgumentList().

If this function reenters the Qt event loop in order to wait for the reply, it will exclude user input. During the wait, it may deliver signals and other method calls to your application. Therefore, it must be prepared to handle a reentrancy whenever a call is placed withcall().

QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode, constQString & method, constQList<QVariant> & args)

Places a call to the remote method specified bymethod on this interface, usingargs as arguments. This function returns the message that was received as a reply, which can be a normalQDBusMessage::ReplyMessage (indicating success) orQDBusMessage::ErrorMessage (if the call failed). Themode 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 usingcall().

Warning: If you useUseEventLoop, 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 isthread-safe.

bool QDBusAbstractInterface::callWithCallback(constQString & method, constQList<QVariant> & args,QObject * receiver, constchar * returnMethod, constchar * errorMethod)

Places a call to the remote method specified bymethod on this interface, usingargs as arguments. This function returns immediately after queueing the call. The reply from the remote function is delivered to thereturnMethod on objectreceiver. If an error occurs, theerrorMethod on objectreceiver is called instead.

This function returns true if the queueing succeeds. It does not indicate that the executed call succeeded. If it fails, theerrorMethod is called. If the queueing failed, this function returns false and no slot will be called.

ThereturnMethod must have as its parameters the types returned by the function call. Optionally, it may have aQDBusMessage parameter as its last or only parameter. TheerrorMethod must have aQDBusError as its only parameter.

This function was introduced in Qt 4.3.

See alsoQDBusError andQDBusMessage.

bool QDBusAbstractInterface::callWithCallback(constQString & method, constQList<QVariant> & args,QObject * receiver, constchar * slot)

This is an overloaded function.

This function is deprecated. Please use the overloaded version.

Places a call to the remote method specified bymethod on this interface, usingargs 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 theslot slot on objectreceiver.

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 alsoQDBusError andQDBusMessage.

QDBusConnection QDBusAbstractInterface::connection() const

Returns the connection this interface is assocated 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 aQDBusInterface.

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 totimeout. -1 means the default DBus timeout (usually 25 seconds).

This function was introduced in Qt 4.8.

See alsotimeout().

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 alsosetTimeout().

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


[8]ページ先頭

©2009-2025 Movatter.jp