Results 1 to 7 of 7

Thread: QTableView: disable row header

  1. #1
    Join Date
    Mar 2006
    Location
    belgium
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QTableView: disable row header

    lol, just realized I was posting my question on a deprecated forum (already wondered why there seemed to be 2 similar fora )

    anyway, here is another question:
    I have a qtableview which displays mail items. I want to disable the row header view. How do I do that? (tried setting it to NULL ) Is a table view actually the right choice in this case? I first tried qlistview, to realise that it has only one column? qtreeview would work too I guess, but is maybe too complicated for my purpose, since I don't have a hierarchical structure?

    thanks

    matthias

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView: disable row header

    Did you try this?
    Qt Code:
    1. _ui.view->verticalHeader()->hide();
    To copy to clipboard, switch view to plain text mode 

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

    mattie (7th March 2006)

  4. #3
    Join Date
    Mar 2006
    Location
    belgium
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView: disable row header

    that does the trick, thanks!

    but I wonder how to find things like that easily. It would be handy if Qt assistant would provide a list of all methods present in a class , including the inherited ones. This is not possible I guess? I checked the class for all hide occurences, and also the QAbstractItemView class, but didn't check the QWidget class as I thought was unrelated to table.
    Because now I hide the widget, but I hope/guess Qt is smart enough to drop the header view generation also? I want to get rid of the (possibly minor) overhead a vertical header adds (I guess it has some overhead on thousands of items).

    matthias

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView: disable row header

    Quote Originally Posted by mattie
    It would be handy if Qt assistant would provide a list of all methods present in a class , including the inherited ones. This is not possible I guess?
    But of course it's possible --- look for "List of all members, including inherited members" link.

  6. #5
    Join Date
    Mar 2006
    Location
    belgium
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView: disable row header

    lol, oops programming off hours doesn't yield a high concentration level in my case, I'm afraid

    or I'm too much in a hurry to get done as much as possible before the morning comes
    I didn't read well, sorry

  7. #6
    Join Date
    Jan 2006
    Location
    Mountain View, CA
    Posts
    279
    Thanked 42 Times in 37 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView: disable row header

    Quote Originally Posted by mattie
    Because now I hide the widget, but I hope/guess Qt is smart enough to drop the header view generation also? I want to get rid of the (possibly minor) overhead a vertical header adds (I guess it has some overhead on thousands of items).
    I don't think it's worth worrying about because since the header widget is hidden, it wont be painted (which is usually the major overhead). If you really care though, you can override headerData() to return empty QVariant objects.
    Save yourself some pain. Learn C++ before learning Qt.

  8. #7
    Join Date
    Mar 2006
    Location
    belgium
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTableView: disable row header

    ok, no problem then, and I'm already returning empty variants

Similar Threads

  1. QTableView currentChanged <> selecting header
    By Everall in forum Qt Programming
    Replies: 4
    Last Post: 1st April 2009, 08:24
  2. How to set QTableView width to width of horizontal header?
    By martinb0820 in forum Qt Programming
    Replies: 0
    Last Post: 2nd December 2008, 20:51
  3. QTableView with fixed header
    By aLiEnHeAd in forum Qt Programming
    Replies: 1
    Last Post: 25th November 2008, 08:14
  4. QTableView header difficulties
    By croftj in forum Qt Programming
    Replies: 6
    Last Post: 30th January 2008, 20:58
  5. QTableView header in corner
    By danstr in forum Qt Programming
    Replies: 3
    Last Post: 18th May 2006, 20:16

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.