summaryrefslogtreecommitdiffstats
path: root/common/modelresult.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2016-06-15 07:48:05 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2016-06-15 07:48:05 +0200
commit3a3545ac93e0b310dfb6c6da5f83df1f26dff8a6 (patch)
treea9627bfb9a23b6b33023c5323cda10d497b2b314 /common/modelresult.cpp
parentbbc604b85a19bc0ed2c7cba6b4e5f6c5ccc21c33 (diff)
downloadsink-3a3545ac93e0b310dfb6c6da5f83df1f26dff8a6.tar.gz
sink-3a3545ac93e0b310dfb6c6da5f83df1f26dff8a6.zip
Automatically fetch children if necessary.
Otherwise a treeview doesn't show the expander until you click on the item (which triggers fetchMore).
Diffstat (limited to 'common/modelresult.cpp')
-rw-r--r--common/modelresult.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/common/modelresult.cpp b/common/modelresult.cpp
index d13f867..9f3e662 100644
--- a/common/modelresult.cpp
+++ b/common/modelresult.cpp
@@ -155,6 +155,13 @@ bool ModelResult<T, Ptr>::hasChildren(const QModelIndex &parent) const
155 if (mQuery.parentProperty.isEmpty() && parent.isValid()) { 155 if (mQuery.parentProperty.isEmpty() && parent.isValid()) {
156 return false; 156 return false;
157 } 157 }
158 //Figure out whether we have children
159 if (canFetchMore(parent)) {
160 //Since we don't retrieve that information as part of the entity,
161 //we have to query for the children to see if we have some
162 auto p = const_cast<ModelResult<T, Ptr>*>(this);
163 p->fetchMore(parent);
164 }
158 return QAbstractItemModel::hasChildren(parent); 165 return QAbstractItemModel::hasChildren(parent);
159} 166}
160 167