Results 1 to 4 of 4

Thread: Display QTreeView expanded in QDialog

  1. #1
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Display QTreeView expanded in QDialog

    I have a QTreeView in a QDialog that displays a hierarchical view of a text report. I want it to display fully expanded .. but it is always initially fully collapsed. There is a combo box in the QDialog that lets the user change the expand level after the report is displayed. The combo box index changed signal is connected to a slot that uses expandAll() and collapseAll() and some custom code to expand other levels if selected. It works fine... after the report is displayed. I have tried sending expandAll() directly after loading the data, in the showEvent of the QDialog, in the loading function for the data.. all the functions execute when I think they should... but the tree is collapsed when it is displayed initially. Any suggestions of more things to try?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: Display QTreeView expanded in QDialog

    No, no other suggestion. You call it at the wrong place. At least that is what my crystal ball says. Some code would be helpful. Is the model set up and attached to the view when you call expandAll()?

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

    LynneV (21st December 2010)

  4. #3
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Display QTreeView expanded in QDialog

    Yes, that was my 'crystal ball' idea, too. The model is setup and attached to the view - I tried that by using the Show event of the Dialog to expand rows...has to be populated by then I should think. I will try some other things and post if I can find a solution.

  5. #4
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Display QTreeView expanded in QDialog

    Yes, that was the problem. Dialogs load their data after exec if FetchMore is used. Needed to do the expand in a separate function as the data was being added to the model. Thanks for pointing me in the correct direction!

Similar Threads

  1. Replies: 6
    Last Post: 3rd November 2010, 15:21
  2. Replies: 3
    Last Post: 17th August 2010, 17:58
  3. Display QDialog on Top of all.
    By sudhansu in forum Qt Programming
    Replies: 6
    Last Post: 22nd April 2010, 08:42
  4. QTreeView restore Expanded node after reload model
    By patrik08 in forum Qt Programming
    Replies: 3
    Last Post: 26th May 2008, 17:42
  5. display informations of QDirModel on QDialog
    By hbill in forum Qt Programming
    Replies: 1
    Last Post: 10th April 2008, 21:36

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.