QEverCloud
Unofficial Evernote Cloud API for Qt
Signals | Public Member Functions | List of all members
qevercloud::AsyncResult Class Reference

Returned by asynchonous versions of functions. More...

Inherits QObject.

Signals

void finished (QVariant result, QSharedPointer< EverCloudExceptionData > error)
 Emitted upon asyncronous call completition. More...
 

Public Member Functions

bool waitForFinished (int timeout=-1)
 Waits for asyncronous operation to complete. More...
 

Detailed Description

Returned by asynchonous versions of functions.

Wait for AsyncResult::finished signal.

Intended usage is something like this:

NoteStore* ns;
Note note;
...
QObject::connect(ns->createNoteAsync(note), &AsyncResult::finished, [](QVariant result, QSharedPointer<EverCloudExceptionData> error) {
if(!error.isNull()) {
// do something in case of an error
} else {
Note note = result.value<Note>();
// process returned result
}
});

Member Function Documentation

void qevercloud::AsyncResult::finished ( QVariant  result,
QSharedPointer< EverCloudExceptionData error 
)
signal

Emitted upon asyncronous call completition.

Parameters
result
errorerror.isNull() != true in case of an error. See EverCloudExceptionData for more details.

AsyncResult deletes itself after emitting this signal. You don't have to manage it's lifetime explicitly.

bool qevercloud::AsyncResult::waitForFinished ( int  timeout = -1)

Waits for asyncronous operation to complete.

Parameters
timeoutMaximum time to wait in milliseconds. Forever if < 0.
Returns
true if finished succesfully, flase in case of the timeout