QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
Public Slots | Signals | Public Member Functions | List of all members
QAsyncSettingsLoader Class Referenceabstract

Defines an asynchronous loader, that can load settings from any thread with any delay. More...

#include <qsettingsloader.h>

+ Inheritance diagram for QAsyncSettingsLoader:

Public Slots

virtual void loadData ()=0
 Will be called asynchronously to load data from the objects thread. More...
 
virtual void saveData (const QVariant &data)=0
 Will be called asynchronously to save data to the objects thread. More...
 
virtual void resetData ()=0
 Will be called asynchronously to reset data to the objects thread. More...
 

Signals

void loadDone (bool successful, const QVariant &data, bool isUserEdited=true)
 Has to be emitted when loading was completed. More...
 
void saveDone (bool successful)
 Has to be emitted when saving was completed. More...
 
void resetDone (bool successful)
 Has to be emitted when resetting was completed. More...
 

Public Member Functions

 QAsyncSettingsLoader ()
 Constructs a new loader (without a parent)
 
bool isAsync () const final
 Specifies, whether this loader is async or not.
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
virtual const QMetaObjectmetaObject () const
 
QString objectName () const
 
void setObjectName (const QString &name)
 
bool isWidgetType () const
 
bool isWindowType () const
 
bool signalsBlocked () const
 
bool blockSignals (bool block)
 
QThreadthread () const
 
void moveToThread (QThread *targetThread)
 
int startTimer (int interval, Qt::TimerType timerType)
 
void killTimer (int id)
 
findChild (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const
 
const QObjectList & children () const
 
void setParent (QObject *parent)
 
void installEventFilter (QObject *filterObj)
 
void removeEventFilter (QObject *obj)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const
 
bool disconnect (const QObject *receiver, const char *method) const
 
void dumpObjectTree ()
 
void dumpObjectInfo ()
 
bool setProperty (const char *name, const QVariant &value)
 
QVariant property (const char *name) const
 
QList< QByteArraydynamicPropertyNames () const
 
void destroyed (QObject *obj)
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const
 
bool inherits (const char *className) const
 
void deleteLater ()
 
- Public Member Functions inherited from QSettingsLoader
virtual ~QSettingsLoader ()
 Virtual destructor.
 
QSimpleSettingsLoadersimple ()
 Casts this instance to a QSimpleSettingsLoader. Will assert if the conversion fails.
 
QAsyncSettingsLoaderasync ()
 Casts this instance to a QAsyncSettingsLoader. Will assert if the conversion fails.
 

Additional Inherited Members

- Static Public Member Functions inherited from QObject
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 
virtual void childEvent (QChildEvent *event)
 
virtual void customEvent (QEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Defines an asynchronous loader, that can load settings from any thread with any delay.

A QObject based loader, capable of loading data from different threads and data with long loading/saving times. Create async loaders on the thread that holds the data (or move them there). The engine will call the load/save/reset methods with a Qt::QueuedConnection and will use the same to react to the signals that indicate a completition of the corresponding task.

For simple sources, that can load fast and on the main thread, please use QSimpleSettingsLoader.

Member Function Documentation

QAsyncSettingsLoader::loadData ( )
pure virtualslot

Will be called asynchronously to load data from the objects thread.

As soon as loading is finished, you have to emit the loadDone signal. This has to be emitted in any case!. You can use the signals parameters to tell the engine about the result of loading.

QAsyncSettingsLoader::loadDone ( bool  successful,
const QVariant data,
bool  isUserEdited = true 
)
signal

Has to be emitted when loading was completed.

Parameters
successfulShould be true, if loading was successful, false if not
dataA QVariant object that contains the loaded data (Use QVariant::Invalid if loading failed)
isUserEditedA bool to specify whether the value comes from the user or is the default. (Defaults to false)

The loaded value should be in data. You can use the isUserEdited parameter to activate/deactivate the entry. If loading was successful, the parameter should be true. If not use false and an error will be shown to the user and the entry that uses this loader will be diabled.

QAsyncSettingsLoader::resetData ( )
pure virtualslot

Will be called asynchronously to reset data to the objects thread.

As soon as resetting is finished, you have to emit the resetDone signal. This has to be emitted in any case!. You can use the signals parameter to tell the engine about the result of resetting.

QAsyncSettingsLoader::resetDone ( bool  successful)
signal

Has to be emitted when resetting was completed.

Parameters
successfulShould be true, if resetting was successful, false if not

If resetting was successful, the parameter should be true. If not use false and an error will be shown to the user and the entry that uses this loader will be diabled.

QAsyncSettingsLoader::saveData ( const QVariant data)
pure virtualslot

Will be called asynchronously to save data to the objects thread.

Parameters
dataThe data to be saved.

As soon as saving is finished, you have to emit the saveDone signal. This has to be emitted in any case!. You can use the signals parameter to tell the engine about the result of saving.

QAsyncSettingsLoader::saveDone ( bool  successful)
signal

Has to be emitted when saving was completed.

Parameters
successfulShould be true, if saving was successful, false if not

If saving was successful, the parameter should be true. If not use false and an error will be shown to the user and the entry that uses this loader will be diabled.


The documentation for this class was generated from the following files: