Results 1 to 5 of 5

Thread: QTreeView Fixed column & QTableView

  1. #1
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTreeView Fixed column & QTableView

    Some time ago ormonde asked how to fix first column in a QTreeView. And jpn & wysota answered him that could be achieved placing two separate views one next to the other.

    http://www.qtcentre.org/forum/f-qt-p...iew-13529.html

    I want to apply this solution, it seems easy and effective, but I want to improve it a little bit, It's possible ?

    I'm working usually with a very large amount of rows ( 50.000 or more ) and a lot of columns too ( 20-50 ). So, I've to manage a lot of data ( 1M to 2.5M different values ). QTreeView is VERY, VERY slow ( in opposition to QTableView , I used before ).

    By now, when I press Page Down, it takes 3-5 seconds to move to the end with 6-7K rows. It's a little bit time expensive.

    I've made some tests and reducing the number of columns in a treeview, reduces too the time to move from end to end, so I've thought that i can place a Qtreeview on the left & a QTableview on the right, making it scrollable for data. The problem is : how can I sincronize indexes & selection moves between views ?

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QTreeView Fixed column & QTableView

    Set the selectionModel of the second view to that of the first (see QAbstractItemView::setSelectionModel()).

    The slowness of the treeview might be improved by setting QTreeView::setUniformRowHeights() to true.

    HTH

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

    jpujolf (1st August 2008)

  4. #3
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView Fixed column & QTableView

    You did it !! Setting uniformRowheights improves speed a lot !! I've presumed that that option was the default. I was wrong...

    Or at least it MUST be the default

    Thanks a lot !!

  5. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTreeView Fixed column & QTableView

    Quote Originally Posted by jpujolf View Post
    Setting uniformRowheights improves speed a lot !! I've presumed that that option was the default. I was wrong...

    Or at least it MUST be the default
    It cannot be the default value because it would break lists which don't happen to have uniform row heights. Having uniform row heights is a common, but still special case. Special cases can be used as optimizations but not as defaults. I guess somebody skipped the "Improving Performance" section in QTreeView while starting to use the class.
    J-P Nurmi

  6. The following user says thank you to jpn for this useful post:

    jpujolf (13th August 2008)

  7. #5
    Join Date
    Jul 2006
    Location
    Catalunya - Spain
    Posts
    117
    Thanks
    16
    Thanked 8 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTreeView Fixed column & QTableView

    Quote Originally Posted by jpn View Post
    I guess somebody skipped the "Improving Performance" section in QTreeView while starting to use the class.
    Oh dear !! I think I've to stop making diagonal-reads of documentation...

Similar Threads

  1. QTableView column trouble
    By nategoofs in forum Qt Programming
    Replies: 6
    Last Post: 27th October 2009, 20:14
  2. QTableView + QSqlQueryModel column alignment
    By frido in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2008, 06:12
  3. Fixed Column in QTreeview
    By ormonde in forum Qt Programming
    Replies: 3
    Last Post: 12th May 2008, 07:49
  4. How to merge QTableView and QTreeView ???
    By Xaleandr in forum Newbie
    Replies: 2
    Last Post: 29th December 2007, 17:58
  5. How to dispay an icon in the first column of QTreeView
    By yogeshm02 in forum Qt Programming
    Replies: 1
    Last Post: 5th January 2006, 15:51

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