Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QDBusAbstractInterface Class Reference
[QtDBus module]

The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the QtDBus binding, allowing access to remote interfaces More...

 #include <QDBusAbstractInterface>

Inherits QObject.

Inherited by QDBusConnectionInterface and QDBusInterface.

This class was introduced in Qt 4.2.


Public Functions

virtual ~QDBusAbstractInterface ()
QDBusPendingCall asyncCall ( 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() )
QDBusPendingCall asyncCallWithArgumentList ( const QString & method, const QList<QVariant> & args )
QDBusMessage call ( 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() )
QDBusMessage call ( 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() )
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
  • 29 public functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 signal inherited from QObject
  • 5 static public members inherited from QObject
  • 7 protected functions inherited from QObject

Detailed Description

The QDBusAbstractInterface class is the base class for all D-Bus interfaces in the QtDBus binding, allowing access to remote interfaces

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

QDBusAbstractInterface::~QDBusAbstractInterface ()   [virtual]

Releases this object's resources.

QDBusPendingCall QDBusAbstractInterface::asyncCall ( 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() )

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

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

This function can be used with up to 8 parameters, passed in arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 and arg8. If you need more than 8 parameters or if you have a variable number of parameters to be passed, use asyncCallWithArgumentList().

It can be used the following way:

 QString value = retrieveValue();
 QDBusPendingCall pcall = interface->asyncCall(QLatin1String("Process"), value);

 QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(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 ( 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::call ( 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() )

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

The parameters to call are passed on to the remote function via D-Bus as input arguments. Output arguments are returned in the QDBusMessage 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 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 and arg8. If you need more than 8 parameters or if you have a variable number of parameters to be passed, use callWithArgumentList().

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, 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() )

This is an overloaded function.

Calls the method method on this interface and passes the parameters to this function to the method. If mode is NoWaitForReply, 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 arguments arg1, arg2, arg3, arg4, arg5, arg6, arg7 and arg8. If you need more than 8 parameters or if you have a variable number of parameters to be passed, use callWithArgumentList().

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 with call().

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

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 103
  2. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 56
  3. «Le projet de loi des droits du développeur» : quelles conditions doivent remplir les entreprises pour que le développeur puisse réussir ? 90
  4. Les développeurs détestent-ils les antivirus ? Un programmeur manifeste sa haine envers ces solutions de sécurité 31
  5. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  6. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 11
Page suivante
  1. Linus Torvalds : le "C++ est un langage horrible", en justifiant le choix du C pour le système de gestion de version Git 100
  2. Comment prendre en compte l'utilisateur dans vos applications ? Pour un développeur, « 90 % des utilisateurs sont des idiots » 231
  3. Quel est LE livre que tout développeur doit lire absolument ? Celui qui vous a le plus marqué et inspiré 96
  4. Apple cède et s'engage à payer des droits à Nokia, le conflit des brevets entre les deux firmes s'achève 158
  5. Nokia porte à nouveau plainte contre Apple pour violation de sept nouveaux brevets 158
  6. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 103
  7. Quel est le code dont vous êtes le plus fier ? Pourquoi l'avez-vous écrit ? Et pourquoi vous a-t-il donné autant de satisfaction ? 83
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.6-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web