Document Class
The Document class proxies a single document stored in the Database. More...
#include <Document>
Properties
Public Functions
Document(QObject * parent = 0) | |
QVariant | getContents() |
bool | getCreate() |
Database * | getDatabase() |
QVariant | getDefaults() |
QString | getDocId() |
void | setContents(QVariant contents) |
void | setCreate(bool create) |
void | setDatabase(Database * database) |
void | setDefaults(QVariant defaults) |
void | setDocId(const QString & docId) |
Signals
void | contentsChanged(QVariant contents) |
void | createChanged(bool create) |
void | databaseChanged(Database * database) |
void | defaultsChanged(QVariant defaults) |
void | docIdChanged(const QString & docId) |
Detailed Description
The Document class proxies a single document stored in the Database.
This is the declarative API equivalent of Database::putDoc() and Database::getDoc().
Property Documentation
contents : QVariant
Updates the contents of the document. A valid docId must be set.
Access functions:
QVariant | getContents() |
void | setContents(QVariant contents) |
Notifier signal:
void | contentsChanged(QVariant contents) |
create : bool
If create is true, docId is not empty and no document with the same docId exists, defaults will be used to store the document.
Access functions:
bool | getCreate() |
void | setCreate(bool create) |
Notifier signal:
void | createChanged(bool create) |
database : Database *
The database is used to lookup the contents of the document, reflecting changes done to it and conversely changes are saved to the database.
Access functions:
Database * | getDatabase() |
void | setDatabase(Database * database) |
Notifier signal:
void | databaseChanged(Database * database) |
defaults : QVariant
The default contents of the document, which are used only if create is true, docId is not empty and no document with the same docId exists in the database yet. If the defaults change, it's up to the API user to handle it.
Access functions:
QVariant | getDefaults() |
void | setDefaults(QVariant defaults) |
Notifier signal:
void | defaultsChanged(QVariant defaults) |
docId : QString
The docId can be that of an existing document in the database and will determine what getContents() returns. If no such documents exists, setDefaults() can be used to supply a preset.
Access functions:
QString | getDocId() |
void | setDocId(const QString & docId) |
Notifier signal:
void | docIdChanged(const QString & docId) |