Results 1 to 4 of 4

Thread: Fixed Column in QTreeview

  1. #1
    Join Date
    May 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Fixed Column in QTreeview

    Hello,

    I've created a Qtreeview with a large number of columns and I'd like the first one (which is a header for the rows) to be fixed when the user scrolls the treeview contents.

    I was able to implement this feature by exchanging the first column with the first column in the viewport each time the scrollbar value changes, but it doesn't work very well.

    Is there an easy way to keep the first column always in the first position, even when the contents are scrolled ?

    Thanks in advance,

    Rodrigo

  2. #2
    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: Fixed Column in QTreeview

    People have usually done this by placing two separate views next to each other. Both views use the same model while duplicate columns being hidden.
    J-P Nurmi

  3. #3
    Join Date
    May 2008
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Fixed Column in QTreeview

    I thought about it. In fact I created a layout with 2 treeviews separated by a splitter. It works, but visually it's not the same thing as a single treeview.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Fixed Column in QTreeview

    Make sure you set the spacing between widgets of the layout to 0. It'll look a bit better then.

Similar Threads

  1. No delegate for 1 column in QTreeView
    By mace in forum Qt Programming
    Replies: 1
    Last Post: 15th February 2007, 11:55
  2. Replies: 0
    Last Post: 10th November 2006, 14:46
  3. hidden QListView column suddenly visible
    By edb in forum Qt Programming
    Replies: 10
    Last Post: 27th January 2006, 09:00
  4. How to dispay an icon in the first column of QTreeView
    By yogeshm02 in forum Qt Programming
    Replies: 1
    Last Post: 5th January 2006, 16:51

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.