Quote Originally Posted by Urvin View Post
I can't imagine what to write in canFetchMore and fetchMore
Back in your first post, you had code like this:
Qt Code:
  1. if (*condition*)
  2. node->children.last()->children.append(new treeNodeClient(-1, tr("Loading..."), node->children.last() ));
To copy to clipboard, switch view to plain text mode 
which I presume now reads:
Qt Code:
  1. node->children.last()->hasChildren = *condition*;
To copy to clipboard, switch view to plain text mode 
instead. You’ll then want something like this:
Qt Code:
  1. bool modelClients::canFetchMore(const QModelIndex& parent) const {
  2. if (!parent.isValid()) return false;
  3. treeNodeClient *node = static_cast<treeNodeClient*>(parent.internalPointer());
  4. return parentNode->hasChildren && !parentNode->children.count();
  5. }
  6.  
  7. void modelClients::fetchMore (const QModelIndex& parent) {
  8. if (!canFetchMore(parent)) return;
  9. treeNodeClient *node = static_cast<treeNodeClient*>(parent.internalPointer());
  10. //
  11. // get the information you need to populate node
  12. //
  13. beginInsertRows(node, 0, mm_IDs.count()-1);
  14. setLists(node, mm_IDs, mm_Names);
  15. endInsertRows();
  16. }
To copy to clipboard, switch view to plain text mode 
for canFetchMore and fetchMore.