summaryrefslogtreecommitdiffstats
path: root/common/modelresult.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-03-03 09:01:05 +0100
commit4d9746c828558c9f872e0aed52442863affb25d5 (patch)
tree507d7c2ba67f47d3cbbcf01a722236ff1b48426b /common/modelresult.h
parent9cea920b7dd51867a0be0fed2f461b6be73c103e (diff)
downloadsink-4d9746c828558c9f872e0aed52442863affb25d5.tar.gz
sink-4d9746c828558c9f872e0aed52442863affb25d5.zip
Fromatted the whole codebase with clang-format.
clang-format -i */**{.cpp,.h}
Diffstat (limited to 'common/modelresult.h')
-rw-r--r--common/modelresult.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/common/modelresult.h b/common/modelresult.h
index 062517f..0f0c06a 100644
--- a/common/modelresult.h
+++ b/common/modelresult.h
@@ -28,11 +28,12 @@
28#include "query.h" 28#include "query.h"
29#include "resultprovider.h" 29#include "resultprovider.h"
30 30
31template<class T, class Ptr> 31template <class T, class Ptr>
32class ModelResult : public QAbstractItemModel 32class ModelResult : public QAbstractItemModel
33{ 33{
34public: 34public:
35 enum Roles { 35 enum Roles
36 {
36 DomainObjectRole = Qt::UserRole + 1, 37 DomainObjectRole = Qt::UserRole + 1,
37 ChildrenFetchedRole, 38 ChildrenFetchedRole,
38 DomainObjectBaseRole 39 DomainObjectBaseRole
@@ -46,7 +47,7 @@ public:
46 int columnCount(const QModelIndex &parent = QModelIndex()) const; 47 int columnCount(const QModelIndex &parent = QModelIndex()) const;
47 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 48 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
48 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; 49 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
49 QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; 50 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
50 QModelIndex parent(const QModelIndex &index) const; 51 QModelIndex parent(const QModelIndex &index) const;
51 bool hasChildren(const QModelIndex &parent = QModelIndex()) const; 52 bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
52 53
@@ -66,7 +67,7 @@ private:
66 QModelIndex createIndexFromId(const qint64 &id) const; 67 QModelIndex createIndexFromId(const qint64 &id) const;
67 void fetchEntities(const QModelIndex &parent); 68 void fetchEntities(const QModelIndex &parent);
68 69
69 //TODO we should be able to directly use T as index, with an appropriate hash function, and thus have a QMap<T, T> and QList<T> 70 // TODO we should be able to directly use T as index, with an appropriate hash function, and thus have a QMap<T, T> and QList<T>
70 QMap<qint64 /* entity id */, Ptr> mEntities; 71 QMap<qint64 /* entity id */, Ptr> mEntities;
71 QMap<qint64 /* parent entity id */, QList<qint64> /* child entity id*/> mTree; 72 QMap<qint64 /* parent entity id */, QList<qint64> /* child entity id*/> mTree;
72 QMap<qint64 /* child entity id */, qint64 /* parent entity id*/> mParents; 73 QMap<qint64 /* child entity id */, qint64 /* parent entity id*/> mParents;
@@ -77,4 +78,3 @@ private:
77 std::function<void(const Ptr &)> loadEntities; 78 std::function<void(const Ptr &)> loadEntities;
78 typename Sink::ResultEmitter<Ptr>::Ptr mEmitter; 79 typename Sink::ResultEmitter<Ptr>::Ptr mEmitter;
79}; 80};
80