Results 1 to 4 of 4

Thread: How to set visible the QTreeWidgetItem expand '+' mark

  1. #1
    Join Date
    Jan 2006
    Posts
    31
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default How to set visible the QTreeWidgetItem expand '+' mark

    Hi,

    I use a QTreeWidget to show 'virtual' files and directories. It means not real files and directories on the file system, but a list of directories/files retrieved from an archive.

    Because retrieving the list of files under a given directory it's a slow operation this is done only on request, i.e. when user clicks and expand on a given directory name.

    Problem is that QTreeWidget shows as 'expandable' with the '+' sign only items that have already children. But directories are populated 'only' when expanded so I would like to set the expand '+' mark also on items without children.

    This example to better clarify:

    On startup QTreeWidget is populated with

    -firstFile
    -secondFile
    -firstDirectory

    firstDirectory has no childern at the moment. Only when user expands the directory then firstDirectory is populated. The problem is that firstDirectory is shown without the '+' mark so user cannot expand it, and directory will never be populated.

  2. #2
    Join Date
    Jan 2006
    Location
    Alingsås, Sweden
    Posts
    437
    Thanks
    3
    Thanked 39 Times in 39 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to set visible the QTreeWidgetItem expand '+' mark

    In Qt 4 you can create a lazy model... but for Qt 3 I guess that you could add a child to all non-searched nodes called "Searching..." or "Updating..." or something. When you have searched it you remove that item and place any actual children there.

  3. #3
    Join Date
    Jan 2006
    Posts
    31
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: How to set visible the QTreeWidgetItem expand '+' mark

    Actually I'm working on Qt4.

    What is a lazy model? is it settable on a QTreeWidget?

  4. #4
    Join Date
    Jan 2007
    Location
    Germany
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to set visible the QTreeWidgetItem expand '+' mark

    What about adding a single child item named "Progressing..." (or s.th. similar)? The user will be able to expand it and will be notified that it will take some time to display the contents.

    Another way is to create a custom item delegate (they are responsible for painting the items) and react on itemActivated. This will you give you some more possibilities, such as showing the user that s.th. is progressing (e.g. a small progressing bar inside the item).

Similar Threads

  1. QTreeWidgetItem ?
    By allensr in forum Qt Programming
    Replies: 5
    Last Post: 3rd January 2007, 17:51
  2. QTreeWidgetItem swap or move up one level problem
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 24th September 2006, 18:34
  3. VS Integration plugins not visible
    By kemp in forum Qt Tools
    Replies: 1
    Last Post: 11th August 2006, 22:22
  4. hidden QListView column suddenly visible
    By edb in forum Qt Programming
    Replies: 10
    Last Post: 27th January 2006, 08:00
  5. How do I find out which widgets/canvas items are visible?
    By Tommytrojan in forum Qt Programming
    Replies: 11
    Last Post: 6th January 2006, 13:22

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.