|
libfuoten
0.8.1
Qt based library to access the ownCloud/Nextcloud News App API
|
#include <Fuoten/Models/BaseModel>
Abstract base class for all data models.
◆ doubleParentId
Stores the parent ID as double to make it accesseable from QML.
This uses the same data as parentId, but converts it between double and qint64. This is a convenience property for use in QML that does not support 64bit integers. As JavaScript and JSON are storing number values according to IEEE 754, there might happen an overflow, if setting values greater than the limit of qint64. Under normal circumstances we simply assume, that there will hardly be greater database IDs than what fits in qint64.
- Access functions:
-
- Notifier signal:
-
◆ inOperation
Returns true while the model is loading data.
- Access functions:
-
- Notifier signal:
-
- See also
- setInOperation()
◆ limit
Limits the result to the specified number of objects.
- Access functions:
-
- Notifier signal:
-
◆ loaded
◆ parentId
Sets the parent database ID to load feeds/items for.
If used on a model presenting feeds, this defines the folder, the feed belongs to. If used on a model presenting items, this defines the feed the items belong to.
- Access functions:
-
- Notifier signal:
-
◆ sortingRole
The role/value used to sort the result.
- Access functions:
-
- Notifier signal:
-
◆ sortOrder
The sorting order.
- Access functions:
-
- Notifier signal:
-
◆ storage
Pointer to a class derived from AbstractStorage.
- Access functions:
-
- Notifier signal:
-
◆ unreadOnly
If true, only unread articles, feeds or folders are returned.
- Access functions:
-
- Notifier signal:
-
◆ BaseModel()
◆ ~BaseModel()
Deconstructs the BaseModel object.
◆ clear()
◆ doubleParentId()
| double doubleParentId |
( |
| ) |
const |
Returns the currently set parent ID as double. This function is for use in QML, that does not support 64bit integers. It performs a static cast from the saved qint64 parent ID to double.
- See also
- doubleParentId
◆ doubleParentIdChanged
| void doubleParentIdChanged |
( |
double |
doubleParentId | ) |
|
|
signal |
This signal is emitted if the parent ID changes.
- See also
- doubleParentId
◆ findByID()
| QModelIndex findByID |
( |
qint64 |
id | ) |
const |
|
virtual |
◆ findByIDs()
| QHash< qint64, QModelIndex > findByIDs |
( |
const IdList & |
ids | ) |
const |
|
virtual |
Returns a hash-table containing IDs and their model index fount in the model.
The default implementation return an empty QHash<qint64, QModelIndex>. Reimplement this function in a subclass.
Reimplemented in AbstractArticleModel, and AbstractFeedModel.
◆ handleStorageChanged()
◆ inOperation()
| bool inOperation |
( |
| ) |
const |
Returns true while the model is loading data.
- See also
- inOperation
◆ inOperationChanged
| void inOperationChanged |
( |
bool |
inOperation | ) |
|
|
signal |
This signal is emitted if the operational state of the model changes.
- See also
- inOperatoin
◆ limit()
◆ limitChanged
| void limitChanged |
( |
int |
limit | ) |
|
|
signal |
◆ load
Loads the model data.
Reimplement this in a subclass. Do only load the data, if loaded() returns false and set setLoaded() to true after the data has been loaded. All later changes, after the model has loaded the initial data, should be done by signals and slots without reloading the full model.
Additionally you could use the inOperation property in this function to indicate, that the model is loading its data.
- Example implementation
{
return;
}
return;
}
Q_D(AbstractFolderModel);
if (!fs.isEmpty()) {
beginInsertRows(QModelIndex(), 0, fs.count() - 1);
d->folders = fs;
endInsertRows();
}
}
◆ loaded()
◆ loadedChanged
| void loadedChanged |
( |
bool |
loaded | ) |
|
|
signal |
◆ parentId()
| qint64 parentId |
( |
| ) |
const |
Returns the currently set parent ID.
- See also
- parentId
◆ parentIdChanged
| void parentIdChanged |
( |
qint64 |
parentId | ) |
|
|
signal |
This signal is emitted if the parent ID changes.
- See also
- parentId
◆ reload
Reloads the complete model.
Will call clear(), will than set loaded to false and will then call load().
◆ setDoubleParentId()
| void setDoubleParentId |
( |
double |
nDoubleParentId | ) |
|
Sets the parent ID via a double. This function is for use in QML, that does not support 64bit integers. It performs a static cast from the double to a qint64 to save it.
- See also
- doubleParentId
◆ setInOperation()
| void setInOperation |
( |
bool |
nInOperation | ) |
|
|
protected |
◆ setLimit()
| void setLimit |
( |
int |
nLimit | ) |
|
◆ setLoaded()
| void setLoaded |
( |
bool |
loaded | ) |
|
|
protected |
Set this to true if the model has initially loaded its data.
In the reimplementation of a BaseModel this should be set in the implementation of the load() function, after the initial data has been loaded.
- See also
- BaseModel::loaded
◆ setParentId()
| void setParentId |
( |
qint64 |
nParentId | ) |
|
◆ setSortingRole()
◆ setSortOrder()
| void setSortOrder |
( |
Qt::SortOrder |
nSortOrder | ) |
|
◆ setStorage()
Sets the pointer to the local storage handler.
- See also
- storage
◆ setUnreadOnly()
| void setUnreadOnly |
( |
bool |
nUnreadOnly | ) |
|
◆ sortingRole()
◆ sortingRoleChanged
◆ sortOrder()
| Qt::SortOrder sortOrder |
( |
| ) |
const |
◆ sortOrderChanged
| void sortOrderChanged |
( |
Qt::SortOrder |
sortOrder | ) |
|
|
signal |
◆ storage()
Returns the pointer to the currently set local storage.
- See also
- storage
◆ storageChanged
This signal is emitted if the poiner to the local storage changes.
- See also
- storage
◆ unreadOnly()
| bool unreadOnly |
( |
| ) |
const |
◆ unreadOnlyChanged
| void unreadOnlyChanged |
( |
bool |
unreadOnly | ) |
|
|
signal |
void createdFolder(qint64 id, const QString &name)
Emit this after a new folder has been created.
void readyChanged(bool ready)
Emitted whenever the ready property changes.
Fuoten::AbstractStorage storage
Pointer to a class derived from AbstractStorage.
Definition: basemodel.h:60
void folderDeleted(qint64 id)
Takes and processes data after a folder has been delted.
Definition: abstractfoldermodel.cpp:277
void load() override
Populates the mode with data from the local storage.
Definition: abstractfoldermodel.cpp:119
void renamedFolder(qint64 id, const QString &newName)
Emit this after a folder has been renamed.
void handleStorageChanged(AbstractStorage *old) override
Connetcs the folder related signals of AbstractStorage to the model's slots.
Definition: abstractfoldermodel.cpp:86
void setLoaded(bool loaded)
Set this to true if the model has initially loaded its data.
Definition: basemodel.cpp:109
void requestedFolders(const QList< QPair< qint64, QString > > &updatedFolders, const QList< QPair< qint64, QString > > &newFolders, const Fuoten::IdList &deletedFolders)
Emit this after folders have been received and processed.
bool loaded
This property holds true if the model has initially loaded the data.
Definition: basemodel.h:137
void markedReadFolder(qint64 id, qint64 newestItem)
Emit this after a folder has been marked as read.
void folderCreated(qint64 id, const QString &name)
Takes and processes data after a folder has been created.
Definition: abstractfoldermodel.cpp:202
void foldersRequested(const QList< QPair< qint64, QString > > &updatedFolders, const QList< QPair< qint64, QString > > &newFolders, const Fuoten::IdList &deletedFolders)
Takes and processes data after folders have been requested.
Definition: abstractfoldermodel.cpp:217
void setInOperation(bool nInOperation)
Sets the inOperation property.
Definition: basemodel.cpp:55
void folderRenamed(qint64 id, const QString &newName)
Takes and processes data after a folder has been renamed.
Definition: abstractfoldermodel.cpp:185
virtual QList< Folder * > getFolders(FuotenEnums::SortingRole sortingRole=FuotenEnums::Name, Qt::SortOrder sortOrder=Qt::AscendingOrder, const IdList &ids=IdList(), FuotenEnums::Type idType=FuotenEnums::Folder, int limit=0)=0
Returns a list of Folder objects from the local storage.
void deletedFolder(qint64 id)
Emit this after a folder has been deleted.
void folderMarkedRead(qint64 id, qint64 newestItem)
Takes and processes data after a folder has been marked as read.
Definition: abstractfoldermodel.cpp:300
@ Name
Definition: fuoten.h:57