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  · 

QDBusInterface Class Reference

The QDBusInterface class is a proxy for interfaces on remote objects. More...

 #include <QDBusInterface>

Inherits: QDBusAbstractInterface.

This class was introduced in Qt 4.2.

Public Functions

QDBusInterface ( const QString & service, const QString & path, const QString & interface = QString(), const QDBusConnection & connection = QDBusConnection::sessionBus(), QObject * parent = 0 )
~QDBusInterface ()

Additional Inherited Members

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

Detailed Description

The QDBusInterface class is a proxy for interfaces on remote objects.

QDBusInterface is a generic accessor class that is used to place calls to remote objects, connect to signals exported by remote objects and get/set the value of remote properties. This class is useful for dynamic access to remote objects: that is, when you do not have a generated code that represents the remote interface.

Calls are usually placed by using the call() function, which constructs the message, sends it over the bus, waits for the reply and decodes the reply. Signals are connected to by using the normal QObject::connect() function. Finally, properties are accessed using the QObject::property() and QObject::setProperty() functions.

The following code snippet demonstrates how to perform a mathematical operation of "2 + 2" in a remote application called com.example.Calculator, accessed via the session bus.

 QDBusInterface remoteApp( "com.example.Calculator", "/Calculator/Operations",
                           "org.mathematics.RPNCalculator" );
 remoteApp.call( "PushOperand", 2 );
 remoteApp.call( "PushOperand", 2 );
 remoteApp.call( "ExecuteOperation", "+" );
 QDBusReply<int> reply = remoteApp.call( "PopOperand" );

 if ( reply.isValid() )
     printf( "%d", reply.value() );          // prints 4

See also QtDBus XML compiler (qdbusxml2cpp).

Member Function Documentation

QDBusInterface::QDBusInterface ( const QString & service, const QString & path, const QString & interface = QString(), const QDBusConnection & connection = QDBusConnection::sessionBus(), QObject * parent = 0 )

Creates a dynamic QDBusInterface object associated with the interface interface on object at path path on service service, using the given connection. If interface is an empty string, the object created will refer to the merging of all interfaces found in that object.

parent is passed to the base class constructor.

If the remote service service is not present or if an error occurs trying to obtain the description of the remote interface interface, the object created will not be valid (see isValid()).

QDBusInterface::~QDBusInterface ()

Destroy the object interface and frees up any resource used.

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