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  · 

QContactAbstractRequest Class Reference

The QContactAbstractRequest class provides a mechanism for asynchronous requests to be made of a manager if it supports them. More...

 #include <QContactAbstractRequest>

Inherits QObject.

Inherited by QContactDetailDefinitionFetchRequest, QContactDetailDefinitionRemoveRequest, QContactDetailDefinitionSaveRequest, QContactFetchByIdRequest, QContactFetchRequest, QContactLocalIdFetchRequest, QContactRelationshipFetchRequest, QContactRelationshipRemoveRequest, QContactRelationshipSaveRequest, QContactRemoveRequest, and QContactSaveRequest.

Public Types

enum RequestType { InvalidRequest, ContactFetchRequest, ContactLocalIdFetchRequest, ContactRemoveRequest, ..., ContactFetchByIdRequest }
enum State { InactiveState, ActiveState, CanceledState, FinishedState }

Public Functions

~QContactAbstractRequest ()
QContactManager::Error error () const
bool isActive () const
bool isCanceled () const
bool isFinished () const
bool isInactive () const
QContactManager * manager () const
void setManager ( QContactManager * manager )
State state () const
RequestType type () const
  • 29 public functions inherited from QObject

Public Slots

bool cancel ()
bool start ()
bool waitForFinished ( int msecs = 0 )
  • 1 public slot inherited from QObject

Signals

void resultsAvailable ()
void stateChanged ( QContactAbstractRequest::State newState )

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QContactAbstractRequest class provides a mechanism for asynchronous requests to be made of a manager if it supports them.

It allows a client to asynchronously request some functionality of a particular QContactManager. Instances of the class will emit signals when the state of the request changes, or when more results become available.

Clients should not attempt to create instances of this class directly, but should instead use the use-case-specific classes derived from this class.

All such request classes have a similar interface: clients set the parameters of the asynchronous call, including which manager the request will be made of, and then call the start() slot of the request. The manager will then enqueue or begin to process the request, at which point the request's state will transition from InactiveState to ActiveState. After any state transition, the request will emit the stateChanged() signal. The manager may periodically update the request with results, at which point the request will emit the resultsAvailable() signal. These results are not guaranteed to have a stable ordering. Error information is considered a result, so some requests will emit the resultsAvailable() signal even if no results are possible from the request (for example, a contact remove request) when the manager updates the request with information about any errors which may have occurred.

Please see the class documentation of each of the use-case-specific classes derived from this class for information about how to retrieve the results of a request (including error information). In all cases, those functions are synchronous, and will return the cached result set with which the manager has updated the request instance if the resultsAvailable() signal has been emitted.

Clients can choose which signals they wish to handle from a request. If the client is not interested in interim results, they can choose to handle only the stateChanged() signal, and in the slot to which that signal is connected, check whether the state has changed to either FinishedState or CanceledState (both of which signify that the manager has finished handling the request, and that the request will not be updated with any more results). If the client is not interested in any results (including error information), they may choose to delete the request after calling start(), or simply not connect the request's signals to any slots.

If the request is allocated via operator new, the client must delete the request when they are no longer using it in order to avoid leaking memory. That is, the client retains ownership of the request.

The client may delete a heap-allocated request in various ways: by deleting it directly (but not within a slot connected to a signal emitted by the request), or by using the deleteLater() slot to schedule the request for deletion when control returns to the event loop (from within a slot connected to a signal emitted by the request, for example stateChanged()).

An active request may be deleted by the client, but the client will not receive any notifications about whether the request succeeded or not, nor any results of the request.

Because clients retain ownership of any request object, and may delete a request object at any time, manager engine implementors must be careful to ensure that they do not assume that a request has not been deleted at some point during processing of a request, particularly if the engine has a multithreaded implementation. It is suggested that engine implementors read the Qt Contacts Manager Engines documentation for more information on this topic.

Member Type Documentation

enum QContactAbstractRequest::RequestType

Enumerates the various possible types of asynchronous requests

ConstantValueDescription
QContactAbstractRequest::InvalidRequest0An invalid request
QContactAbstractRequest::ContactFetchRequest1A request to fetch a list of contacts
QContactAbstractRequest::ContactLocalIdFetchRequest2A request to fetch a list of local contact ids
QContactAbstractRequest::ContactRemoveRequest3A request to remove a list of contacts
QContactAbstractRequest::ContactSaveRequest4A request to save a list of contacts
QContactAbstractRequest::DetailDefinitionFetchRequest5A request to fetch a collection of detail definitions
QContactAbstractRequest::DetailDefinitionRemoveRequest6A request to remove a list of detail definitions
QContactAbstractRequest::DetailDefinitionSaveRequest7A request to save a list of detail definitions
QContactAbstractRequest::RelationshipFetchRequest8A request to fetch relationships between contacts
QContactAbstractRequest::RelationshipRemoveRequest9A request to remove any relationships which match the request criteria
QContactAbstractRequest::RelationshipSaveRequest10A request to save a list of relationships
QContactAbstractRequest::ContactFetchByIdRequest11A request to fetch a list of contacts given a list of ids

enum QContactAbstractRequest::State

Enumerates the various states that a request may be in at any given time

ConstantValueDescription
QContactAbstractRequest::InactiveState0Operation not yet started
QContactAbstractRequest::ActiveState1Operation started, not yet finished
QContactAbstractRequest::CanceledState2Operation is finished due to cancellation
QContactAbstractRequest::FinishedState3Operation successfully completed

Member Function Documentation

QContactAbstractRequest::~QContactAbstractRequest ()

Cleans up the memory used by this request

bool QContactAbstractRequest::cancel () [slot]

Attempts to cancel the request. Returns false if the request is not in the QContactAbstractRequest::Active state, or if the request is unable to be cancelled by the manager engine; otherwise returns true.

QContactManager::Error QContactAbstractRequest::error () const

Returns the overall error of the most recent asynchronous operation

bool QContactAbstractRequest::isActive () const

Returns true if the request is in the QContactAbstractRequest::ActiveState state; otherwise, returns false

See also state().

bool QContactAbstractRequest::isCanceled () const

Returns true if the request is in the QContactAbstractRequest::CanceledState; otherwise, returns false

See also state().

bool QContactAbstractRequest::isFinished () const

Returns true if the request is in the QContactAbstractRequest::FinishedState; otherwise, returns false

See also state().

bool QContactAbstractRequest::isInactive () const

Returns true if the request is in the QContactAbstractRequest::InactiveState state; otherwise, returns false

See also state().

QContactManager * QContactAbstractRequest::manager () const

Returns a pointer to the manager of which this request instance requests operations

See also setManager().

void QContactAbstractRequest::resultsAvailable () [signal]

This signal is emitted when new results are available. Results can include the operation error which may be accessed via error(), or derived-class-specific results which are accessible through the derived class API.

See also error().

void QContactAbstractRequest::setManager ( QContactManager * manager )

Sets the manager of which this request instance requests operations to manager

If the request is currently active, this function will return without updating the manager object.

See also manager().

bool QContactAbstractRequest::start () [slot]

Attempts to start the request. Returns false if the request is not in the QContactAbstractRequest::Inactive, QContactAbstractRequest::Finished or QContactAbstractRequest::Cancelled states, or if the request was unable to be performed by the manager engine; otherwise returns true.

State QContactAbstractRequest::state () const

Returns the current state of the request.

void QContactAbstractRequest::stateChanged ( QContactAbstractRequest::State newState ) [signal]

This signal is emitted when the state of the request is changed. The new state of the request will be contained in newState.

RequestType QContactAbstractRequest::type () const

Returns the type of this asynchronous request

bool QContactAbstractRequest::waitForFinished ( int msecs = 0 ) [slot]

Blocks until the request has been completed by the manager engine, or until msecs milliseconds has elapsed. If msecs is zero or negative, this function will block until the request is complete, regardless of how long it takes. Returns true if the request was cancelled or completed successfully within the given period, otherwise false. Some backends are unable to support this operation safely, and will return false immediately.

Note that any signals generated while waiting for the request to complete may be queued and delivered some time after this function has returned, when the calling thread's event loop is dispatched. If your code depends on your slots being invoked, you may need to process events after calling this function.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

[0]; s.parentNode.insertBefore(ga, s); })();
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. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 43
  4. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
Page suivante

Le Qt Labs au hasard

Logo

QMake et au-delà, le retour

Les Qt Labs sont les laboratoires des développeurs de Qt, où ils peuvent partager des impressions sur le framework, son utilisation, ce que pourrait être son futur. 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 qtmobility-1.1
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