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  · 

QDBusMessage Class Reference
[QtDBus module]

The QDBusMessage class represents one message sent or received over the D-Bus bus. More...

 #include <QDBusMessage>

This class was introduced in Qt 4.2.


Public Types

enum MessageType { MethodCallMessage, SignalMessage, ReplyMessage, ErrorMessage, InvalidMessage }

Public Functions

QDBusMessage ()
QDBusMessage ( const QDBusMessage & other )
~QDBusMessage ()
QList<QVariant> arguments () const
QDBusMessage createErrorReply ( const QString name, const QString & msg ) const
QDBusMessage createErrorReply ( const QDBusError & error ) const
QDBusMessage createErrorReply ( QDBusError::ErrorType type, const QString & msg ) const
QDBusMessage createReply ( const QList<QVariant> & arguments = QList<QVariant> () ) const
QDBusMessage createReply ( const QVariant & argument ) const
QString errorMessage () const
QString errorName () const
QString interface () const
bool isDelayedReply () const
bool isReplyRequired () const
QString member () const
QString path () const
QString service () const
void setArguments ( const QList<QVariant> & arguments )
void setDelayedReply ( bool enable ) const
QString signature () const
MessageType type () const
QDBusMessage & operator<< ( const QVariant & arg )
QDBusMessage & operator= ( const QDBusMessage & other )

Static Public Members

QDBusMessage createError ( const QString & name, const QString & msg )
QDBusMessage createError ( const QDBusError & error )
QDBusMessage createError ( QDBusError::ErrorType type, const QString & msg )
QDBusMessage createMethodCall ( const QString & service, const QString & path, const QString & interface, const QString & method )
QDBusMessage createSignal ( const QString & path, const QString & interface, const QString & name )

Detailed Description

The QDBusMessage class represents one message sent or received over the D-Bus bus.

This object can represent any of the four different types of messages (MessageType) that can occur on the bus:

  • Method calls
  • Method return values
  • Signal emissions
  • Error codes

Objects of this type are created with the static createError(), createMethodCall() and createSignal() functions. Use the QDBusConnection::send() function to send the messages.


Member Type Documentation

enum QDBusMessage::MessageType

The possible message types:

ConstantValueDescription
QDBusMessage::MethodCallMessage1a message representing an outgoing or incoming method call
QDBusMessage::SignalMessage4a message representing an outgoing or incoming signal emission
QDBusMessage::ReplyMessage2a message representing the return values of a method call
QDBusMessage::ErrorMessage3a message representing an error condition in response to a method call
QDBusMessage::InvalidMessage0an invalid message: this is never set on messages received from D-Bus


Member Function Documentation

QDBusMessage::QDBusMessage ()

Constructs an empty, invalid QDBusMessage object.

See also createError(), createMethodCall(), and createSignal().

QDBusMessage::QDBusMessage ( const QDBusMessage & other )

Constructs a copy of the object given by other.

Note: QDBusMessage objects are shared. Modifications made to the copy will affect the original one as well. See setDelayedReply() for more information.

QDBusMessage::~QDBusMessage ()

Disposes of the object and frees any resources that were being held.

QList<QVariant> QDBusMessage::arguments () const

Returns the list of arguments that are going to be sent or were received from D-Bus.

See also setArguments().

QDBusMessage QDBusMessage::createError ( const QString & name, const QString & msg )   [static]

Constructs a new DBus message representing an error, with the given name and msg.

QDBusMessage QDBusMessage::createError ( const QDBusError & error )   [static]

Constructs a new DBus message representing the given error.

QDBusMessage QDBusMessage::createError ( QDBusError::ErrorType type, const QString & msg )   [static]

Constructs a new DBus message for the error type type using the message msg. Returns the DBus message.

QDBusMessage QDBusMessage::createErrorReply ( const QString name, const QString & msg ) const

Constructs a new DBus message representing an error reply message, with the given name and msg.

QDBusMessage QDBusMessage::createErrorReply ( const QDBusError & error ) const

Constructs a new DBus message representing an error reply message, from the given error object.

QDBusMessage QDBusMessage::createErrorReply ( QDBusError::ErrorType type, const QString & msg ) const

Constructs a new DBus reply message for the error type type using the message msg. Returns the DBus message.

QDBusMessage QDBusMessage::createMethodCall ( const QString & service, const QString & path, const QString & interface, const QString & method )   [static]

Constructs a new DBus message representing a method call. A method call always informs its destination address (service, path, interface and method).

The DBus bus allows calling a method on a given remote object without specifying the destination interface, if the method name is unique. However, if two interfaces on the remote object export the same method name, the result is undefined (one of the two may be called or an error may be returned).

When using DBus in a peer-to-peer context (i.e., not on a bus), the service parameter is optional.

The QDBusObject and QDBusInterface classes provide a simpler abstraction to synchronous method calling.

This function returns a QDBusMessage object that can be sent with QDBusConnection::call().

QDBusMessage QDBusMessage::createReply ( const QList<QVariant> & arguments = QList<QVariant> () ) const

Constructs a new DBus message representing a reply, with the given arguments.

QDBusMessage QDBusMessage::createReply ( const QVariant & argument ) const

Constructs a new DBus message representing a reply, with the given argument.

QDBusMessage QDBusMessage::createSignal ( const QString & path, const QString & interface, const QString & name )   [static]

Constructs a new DBus message with the given path, interface and name, representing a signal emission.

A DBus signal is emitted from one application and is received by all applications that are listening for that signal from that interface.

The QDBusMessage object that is returned can be sent using the QDBusConnection::send() function.

QString QDBusMessage::errorMessage () const

Returns the human-readable message associated with the error that was received.

This function was introduced in Qt 4.3.

QString QDBusMessage::errorName () const

Returns the name of the error that was received.

QString QDBusMessage::interface () const

Returns the interface of the method being called (in the case of a method call) or of the signal being received from.

bool QDBusMessage::isDelayedReply () const

Returns the delayed reply flag, as set by setDelayedReply(). By default, this flag is false, which means QtDBus will generate automatic replies when necessary.

bool QDBusMessage::isReplyRequired () const

Returns the flag that indicates if this message should see a reply or not. This is only meaningful for method call messages: any other kind of message cannot have replies and this function will always return false for them.

QString QDBusMessage::member () const

Returns the name of the signal that was emitted or the name of the method that was called.

QString QDBusMessage::path () const

Returns the path of the object that this message is being sent to (in the case of a method call) or being received from (for a signal).

QString QDBusMessage::service () const

Returns the name of the service or the bus address of the remote method call.

void QDBusMessage::setArguments ( const QList<QVariant> & arguments )

Sets the arguments that are going to be sent over D-Bus to arguments. Those will be the arguments to a method call or the parameters in the signal.

See also arguments().

void QDBusMessage::setDelayedReply ( bool enable ) const

Sets whether the message will be replied later (if enable is true) or if an automatic reply should be generated by QtDBus (if enable is false).

In D-Bus, all method calls must generate a reply to the caller, unless the caller explicitly indicates otherwise (see isReplyRequired()). QtDBus automatically generates such replies for any slots being called, but it also allows slots to indicate whether they will take responsibility of sending the reply at a later time, after the function has finished processing.

See also isDelayedReply() and Delayed Replies.

QString QDBusMessage::signature () const

Returns the signature of the signal that was received or for the output arguments of a method call.

MessageType QDBusMessage::type () const

Returns the message type.

QDBusMessage & QDBusMessage::operator<< ( const QVariant & arg )

Appends the argument arg to the list of arguments to be sent over D-Bus in a method call or signal emission.

QDBusMessage & QDBusMessage::operator= ( const QDBusMessage & other )

Copies the contents of the object given by other.

Note: QDBusMessage objects are shared. Modifications made to the copy will affect the original one as well. See setDelayedReply() for more information.

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 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 7
Page suivante

Le Qt Quarterly au hasard

Logo

Un plugin pour QImage

Qt Quarterly est la revue trimestrielle proposée par Nokia et à destination des développeurs Qt. Ces articles d'une grande qualité technique sont rédigés par des experts Qt. 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