Results 1 to 6 of 6

Thread: QFileSystemModel /QTreeView, check and expend all items under a user checked item

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Join Date
    Feb 2013
    Location
    San Diego
    Posts
    37
    Thanks
    14
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Default Re: QFileSystemModel /QTreeView, check and expend all items under a user checked item

    Hi,
    I'm still stuck with that issue. I'm expecting a directoryLoaded() signal after I called fetchMore() and it never comes.

    A directoryLoaded() is emited when I expand an item in the QtreeView though, so I decided to look into QtreeView.cpp to see how the fetchMore() calls are implemented.
    I looked at the expand all implementation, because it is very close to what I want to acheive after all. (Expand all the items under a user checked item)

    Actually QTreeView::expandAll() calls a generic member of its private Class, QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninitialized), which runs recursively and which calls fetchmore()
    as follows:
    Qt Code:
    1. int count = 0;
    2. if (model->hasChildren(parent)) {
    3. if (model->canFetchMore(parent))
    4. model->fetchMore(parent);
    5. count = model->rowCount(parent);
    6. }
    To copy to clipboard, switch view to plain text mode 
    I don't get it. I've seen in several other threads pepole complaining about unexpected rowcount() returned values. And the given explanation for that behavior was the asynchorneous nature of the QFileSystemModel data update process. (The data is still being updated when rowCount() is called.)
    That was the all point of what I'm trying to do, making sure that the data is updateed when I call fetchmore(). (See code in my previous message)
    By looking a the QtreeVieww implementation, rowCount() is called right after fetchMore(). It doesn't seem to be a problem, execpt that when I try the same implentation in my code I end up with the same unexpected count value. And when I try to detect directoryLoaded() after calling fetchmore(), I never get it... I'm stuck!

    Could someone help me with that? Thanks

  2. The following user says thank you to Guett_31 for this useful post:


Similar Threads

  1. Replies: 2
    Last Post: 17th May 2011, 13:47
  2. QTreeView different item delegate for child items possible?
    By Royceybaby in forum Qt Programming
    Replies: 4
    Last Post: 7th January 2010, 21:14
  3. Replies: 2
    Last Post: 13th September 2008, 13:55
  4. Checked item in QTreeWidget?
    By vishal.chauhan in forum Qt Programming
    Replies: 18
    Last Post: 3rd January 2008, 20:18
  5. Iterate and get Checked QTable items??
    By darpan in forum Newbie
    Replies: 2
    Last Post: 10th May 2006, 18:27

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.