QGalleryAbstractRequest Class ReferenceThe QGalleryAbstractRequest class provides a base class for gallery requests. More... #include <QGalleryAbstractRequest> Inherits QObject. Inherited by QGalleryItemRequest, QGalleryQueryRequest, and QGalleryTypeRequest. Public Types
Properties
Public Functions
Public Slots
Signals
Protected Functions
Additional Inherited Members
Detailed DescriptionThe QGalleryAbstractRequest class provides a base class for gallery requests. Gallery requests are the interface through which clients can interact with a gallery to execute queries or perform actions. QAbstractGalleryRequest manages executing requests against a gallery and reporting the state of responses. In order to execute a request it is first necessary to assign the gallery to the request. If the request is supported by the gallery the supported property will be true, otherwise if the request is not supported or no gallery is assigned to the request supported will be false. Once a request has been assigned a gallery and its own arguments it can be executed. As requests are asynchronous results will not be available immediately, instead the request will go into an Active state until it is finished. If the request is successful the finished() signal will be emitted and if not the error() signal will be emitted, in both cases the stateChanged() signal will be emitted with the new state of the request. Active requests can be canceled by calling the cancel() function. Canceling a request can also be an asynchronous action and does not always prevent a request from finishing successfully such as when the earliest possible point to interrupt a request is on completion. If a canceled request isn't aborted immediately it will go into the Canceling state until it is aborted and enters the Canceled state or succeeds and enters the Finished state. Some requests support automatically updating their results in response to changes in their source data or some other event. A request that will provide these sort of updates will enter the Idle state upon finishing its initial request. From the Idle state a request may return to the Active state itself to refresh its results or update it results immeditately if a a new query is not required. Cancelling an idle request will put it into the Finished state and prevent future updates. While requests are asynchronous it is possible to use them in a synchronous manner by using the waitForFinished() function to block until the request has finished. Member Type Documentation
|
Constant | Value | Description |
---|---|---|
QGalleryAbstractRequest::NoError | 0 | No error. |
QGalleryAbstractRequest::NoGallery | 1 | No gallery found. |
QGalleryAbstractRequest::NotSupported | 2 | Request is not supported. |
QGalleryAbstractRequest::GalleryError | 100 | The gallery is wrong or corrupt. |
Identifies the type of a request.
Constant | Value | Description |
---|---|---|
QGalleryAbstractRequest::QueryRequest | 0 | The request is a QGalleryQueryRequest. |
QGalleryAbstractRequest::ItemRequest | 1 | The request is a QGalleryItemRequest. |
QGalleryAbstractRequest::TypeRequest | 2 | The request is a QGalleryTypeRequest |
Identifies the state of a gallery request.
Constant | Value | Description |
---|---|---|
QGalleryAbstractRequest::Inactive | 0 | The request has not been executed. |
QGalleryAbstractRequest::Active | 1 | The request is currently executing. |
QGalleryAbstractRequest::Canceling | 2 | The request was canceled, but hasn't yet reached the Canceled state. |
QGalleryAbstractRequest::Canceled | 3 | The request was canceled. |
QGalleryAbstractRequest::Idle | 4 | The request has finished, but may return to the active state in response to an internal event. |
QGalleryAbstractRequest::Finished | 5 | The request is finished. |
QGalleryAbstractRequest::Error | 6 | The request runs into an error. |
This property holds the current progress of a request.
Access functions:
int | currentProgress () const |
Notifier signal:
void | progressChanged ( int current, int maximum ) |
This property holds the error encountered by an unsuccessful request.
Common errors are defined in Error, more specific errors are defined by the gallery implementations such as in QDocumentGallery::Error.
Access functions:
int | error () const |
void | error ( int error, const QString & errorString ) |
Notifier signal:
void | errorChanged () |
This property holds a string describing the cause of an error in more detail.
This may be an empty string if more information is not known.
Access functions:
QString | errorString () const |
Notifier signal:
void | errorChanged () |
This property holds the gallery service a request acts on.
Access functions:
QAbstractGallery * | gallery () const |
void | setGallery ( QAbstractGallery * gallery ) |
Notifier signal:
void | galleryChanged () |
This property holds the maximum value of currentProgress.
Access functions:
int | maximumProgress () const |
Notifier signal:
void | progressChanged ( int current, int maximum ) |
This property holds the state of a request.
Access functions:
State | state () const |
Notifier signal:
void | stateChanged ( QGalleryAbstractRequest::State state ) |
This property holds whether a request is supported by its current gallery.
Access functions:
bool | isSupported () const |
Notifier signal:
void | supportedChanged () |
Constructs a new gallery type request.
The parent is passed to QObject.
Constructs a new type request for the given gallery.
The parent is passed to QObject.
Destroys a gallery request.
Cancels the execution of a request. If the request is idle this will stop any future updates.
Signals that a request was canceled before it could finish.
Clears the results of a request.
If the request is active or idle it will be canceled.
Signals that the error and errorString properties have changed.
Executes a request.
Note: A valid gallery must be set before a request can be executed.
Signals that a request has finished.
Signals that the value of gallery has changed.
Signals that the current or maximum progress value has changed.
Sets the response to an executed request.
Signals that the state of a request has changed.
Signals the supported property has changed.
Returns the type of a request.
Waits for msecs for the a request to finish.
Returns true if the request has finished on return, and returns false if the wait time expires or the request is inactive or idle.