diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-04 15:46:51 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-12-04 15:46:51 +0100 |
commit | 983af5f1442ff27dc14da6fdac28f51a38184f0a (patch) | |
tree | 75bd078bcd50093778048beb9bfa5ec4a4c97ab9 /common | |
parent | 553000673acf7297cfa4de620290ba73f3c438ac (diff) | |
download | sink-983af5f1442ff27dc14da6fdac28f51a38184f0a.tar.gz sink-983af5f1442ff27dc14da6fdac28f51a38184f0a.zip |
ModelResult header data, and support listing various types in the
dummyclient
Diffstat (limited to 'common')
-rw-r--r-- | common/modelresult.cpp | 11 | ||||
-rw-r--r-- | common/modelresult.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp index 4fd8d97..d2a7e88 100644 --- a/common/modelresult.cpp +++ b/common/modelresult.cpp | |||
@@ -65,6 +65,17 @@ int ModelResult<T, Ptr>::columnCount(const QModelIndex &parent) const | |||
65 | } | 65 | } |
66 | 66 | ||
67 | template<class T, class Ptr> | 67 | template<class T, class Ptr> |
68 | QVariant ModelResult<T, Ptr>::headerData(int section, Qt::Orientation orientation, int role) const | ||
69 | { | ||
70 | if (role == Qt::DisplayRole) { | ||
71 | if (section < mPropertyColumns.size()) { | ||
72 | return mPropertyColumns.at(section); | ||
73 | } | ||
74 | } | ||
75 | return QVariant(); | ||
76 | } | ||
77 | |||
78 | template<class T, class Ptr> | ||
68 | QVariant ModelResult<T, Ptr>::data(const QModelIndex &index, int role) const | 79 | QVariant ModelResult<T, Ptr>::data(const QModelIndex &index, int role) const |
69 | { | 80 | { |
70 | if (role == DomainObjectRole) { | 81 | if (role == DomainObjectRole) { |
diff --git a/common/modelresult.h b/common/modelresult.h index 298e157..ec62a67 100644 --- a/common/modelresult.h +++ b/common/modelresult.h | |||
@@ -45,6 +45,7 @@ public: | |||
45 | int rowCount(const QModelIndex &parent = QModelIndex()) const; | 45 | int rowCount(const QModelIndex &parent = QModelIndex()) const; |
46 | int columnCount(const QModelIndex &parent = QModelIndex()) const; | 46 | int columnCount(const QModelIndex &parent = QModelIndex()) const; |
47 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; | 47 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; |
48 | QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; | ||
48 | QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; | 49 | QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex()) const; |
49 | QModelIndex parent(const QModelIndex &index) const; | 50 | QModelIndex parent(const QModelIndex &index) const; |
50 | bool hasChildren(const QModelIndex &parent = QModelIndex()) const; | 51 | bool hasChildren(const QModelIndex &parent = QModelIndex()) const; |