Nepomuk
#include <Nepomuk/Utils/ResourceModel>
Public Types | |
enum | ResourceModelColumns { ResourceColumn = 0, ResourceTypeColumn = 1, ResourceModelColumnCount = 2 } |
enum | ResourceRoles { ResourceRole = 7766897, ResourceTypeRole = 687585, ResourceCreationDateRole = 7766898 } |
Public Member Functions | |
ResourceModel (QObject *parent=0) | |
virtual | ~ResourceModel () |
virtual int | columnCount (const QModelIndex &parent) const |
virtual QVariant | data (const QModelIndex &index, int role=Qt::DisplayRole) const |
virtual Qt::ItemFlags | flags (const QModelIndex &index) const |
virtual QVariant | headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const |
virtual QModelIndex | indexForResource (const Resource &res) const =0 |
virtual QMimeData * | mimeData (const QModelIndexList &indexes) const |
virtual QStringList | mimeTypes () const |
virtual QModelIndex | parent (const QModelIndex &child) const |
virtual Resource | resourceForIndex (const QModelIndex &index) const =0 |
virtual bool | setData (const QModelIndex &index, const QVariant &value, int role) |
Detailed Description
Base class for all models providing a plain list of resources.
The ResourceModel is a base class for models that handle a set of Nepomuk Resource instances. This can be a simple list as in SimpleResourceModel or a set of query results as in ResultModel. It could also be a dynamic list which is updated while the user scrolls it.
ResourceModel cannot be instanciated by itself. Use one of the subclasses or derive your own subclass from it.
At least the following methods need to be implemented in a subclass:
- resourceForIndex()
- indexForResource(),
- QAbstractItemModel::rowCount()
- QAbstractItemModel::index()
- Since
- 4.6
Definition at line 57 of file resourcemodel.h.
Member Enumeration Documentation
The columns supported by ResourceModel are identified by this enumeration.
Definition at line 76 of file resourcemodel.h.
Custom roles that can be accessed for example in delegates.
Enumerator | |
---|---|
ResourceRole |
The resource itself, provided as a Nepomuk::Resource instance. |
ResourceTypeRole |
The type of the resource, provided as a Nepomuk::Types::Class instance. |
ResourceCreationDateRole |
The creation date of the resource. |
Definition at line 90 of file resourcemodel.h.
Constructor & Destructor Documentation
Nepomuk::Utils::ResourceModel::ResourceModel | ( | QObject * | parent = 0 | ) |
Constructor.
|
virtual |
Destructor.
Member Function Documentation
|
virtual |
The default implementation returns 2 with the first column representing the resource itself and the second one showing the type.
|
virtual |
Handles most roles typically used in applications like Qt::DisplayRole, Qt::ToolTipRole, and Qt::DecorationRole.
Additionally KCategorizedSortFilterProxyModel roles are supported categorizing by resource types.
|
virtual |
Reimplemented to support dragging of resources out of the model.
|
virtual |
Provides header data for the supported columns.
|
pure virtual |
Get the index for a resource.
- Returns
- The index which corresponds to
res
of an invalid QModelIndex ifres
is not part of this model.
Implemented in Nepomuk::Utils::SimpleResourceModel.
|
virtual |
Stores the resource URIs via KUrl::List::populateMimeData() and as a specific "application/x-nepomuk-resource-uri" mime type to indicate that these are URIs corresponding to actual Nepomuk resources.
|
virtual |
- Returns
- The KUrl mime types and "application/x-nepomuk-resource-uri".
|
virtual |
The default implementation returns an invalid QModelIndex, thus providing a plain list.
|
pure virtual |
Get the Resource which corresponds to index
.
Implemented in Nepomuk::Utils::SimpleResourceModel.
|
virtual |
Provided for future extensions.
The documentation for this class was generated from the following file:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.