Results 1 to 2 of 2

Thread: QTreeView expanding perfromance issue

  1. #1
    Join Date
    Jul 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default QTreeView expanding perfromance issue

    a model with 400k nodes, and i expand all and collapse all for top node, and then expand it again, QTreeView will stuck, from the call stack , it will insert treeview item. Is there any way to improve it? Thanks.

    call stack :
    #2 0x00007ffff7426043 in QTreeViewPrivate::insertViewItems(int, int, QTreeViewItem const&) () from /remote/vginterfaces2/verdi_thirdparty/QT/QT485_PACKnew/lib/LINUXAMD64/libQtGui.so.4
    #3 0x00007ffff742cbc5 in QTreeViewPrivate::layout(int, bool, bool) () from /remote/vginterfaces2/verdi_thirdparty/QT/QT485_PACKnew/lib/LINUXAMD64/libQtGui.so.4
    #4 0x00007ffff742c865 in QTreeViewPrivate::layout(int, bool, bool) () from /remote/vginterfaces2/verdi_thirdparty/QT/QT485_PACKnew/lib/LINUXAMD64/libQtGui.so.4
    #5 0x00007ffff742c865 in QTreeViewPrivate::layout(int, bool, bool) () from /remote/vginterfaces2/verdi_thirdparty/QT/QT485_PACKnew/lib/LINUXAMD64/libQtGui.so.4
    #6 0x00007ffff742c865 in QTreeViewPrivate::layout(int, bool, bool) () from /remote/vginterfaces2/verdi_thirdparty/QT/QT485_PACKnew/lib/LINUXAMD64/libQtGui.so.4
    #7 0x00007ffff742d400 in QTreeViewPrivate::expand(int, bool) () from /remote/vginterfaces2/verdi_thirdparty/QT/QT485_PACKnew/lib/LINUXAMD64/libQtGui.so.4

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QTreeView expanding perfromance issue

    Is there any way to improve it?
    Don't call expandAll() on the root node.

    All of the calls you show in your stack trace are the result of computations the tree view must do to determine the layout of the expanded tree. It has to do that before it knows how to draw the tree on screen.

    In any case, what is the point of calling expandAll() on a tree with 400K nodes? You can only see a small fraction of them at any time. You would probably be better off to call expandToDepth() instead to show a smaller number of nodes.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QTreeView height issue
    By mqt in forum Qt Programming
    Replies: 2
    Last Post: 23rd October 2013, 07:36
  2. QTreeView and expanding items just added
    By googie in forum Qt Programming
    Replies: 1
    Last Post: 23rd April 2013, 06:39
  3. QTreeView remove issue
    By ComaWhite in forum Qt Programming
    Replies: 3
    Last Post: 2nd January 2010, 19:13
  4. Restore QTreeView expanding
    By zack in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2009, 17:54
  5. Replies: 1
    Last Post: 28th February 2007, 08:34

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.