Results 1 to 2 of 2

Thread: Not allow expander Icon to expand items in QTreeview

  1. #1
    Join Date
    Jun 2018
    Location
    India
    Posts
    34
    Thanks
    3
    Qt products
    Qt4 Qt5
    Platforms
    Windows

    Question Not allow expander Icon to expand items in QTreeview

    Hi,

    I have a QTreeView with read-only custom model derived from QAbstractItemModel. On Double-clicking the TreeItem, I am calling setExpanded(index,false) in order to wait till the parent node gets populated and calling setExpanded(index,true) once all the data is arrived.

    The above scenario works perfectly.But when I try to click the expander/collapsible icon (while the expanded state of the tree item state is still false), the parent node expands and shows the child nodes irrespective of the state.

    I want to disable this icon (or) try to get a signal on this icon click so that my tree-view will expand only after all the data population done.

    Please help on this as this is affecting my UI performance in case of huge data

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Not allow expander Icon to expand items in QTreeview

    Hmm.

    The model could not tell the view that it already has children for a particular model index until it has all of them.

    Or it could return just a single "dummy" entry that says something like "loading...", or even an indication of progress.

    So while you are fetching data your model's internal data structure would get updated but the model would "remember" that this is currently "internal".

    Cheers,
    _

  3. The following user says thank you to anda_skoa for this useful post:

    chithara (22nd May 2019)

Similar Threads

  1. Replies: 0
    Last Post: 18th January 2016, 04:41
  2. QTreeView: expand() have performance issue
    By jasonhxs in forum Qt Programming
    Replies: 0
    Last Post: 27th August 2014, 05:34
  3. QTreeView expand and collapse
    By Qiieha in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2012, 13:57
  4. adding one icon to all items in QTreeView
    By Mystical Groovy in forum Qt Programming
    Replies: 6
    Last Post: 6th October 2009, 13:13
  5. QTreeView expand signals
    By Vidar Bøe in forum Qt Programming
    Replies: 2
    Last Post: 26th May 2008, 10:47

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.