Results 1 to 8 of 8

Thread: How to remove headers from QTableView.

  1. #1
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up How to remove headers from QTableView.

    Hi All,

    I am having QTableView, For this view i am using QStandardItemModel My Code is like this,

    Qt Code:
    1. QTableView *m_pTimeTableView;
    2. QStandardItemModel *m_pTableModel ;
    3.  
    4. m_pTableModel = new QStandardItemModel(0,5,this);
    5.  
    6. m_pTableModel->setColumnCount(5);
    7.  
    8. m_pTableModel->insertRow(0);
    9. m_pTableModel->setData(m_pTableModel->index(0, 0), 160);
    10. m_pTableModel->setData(m_pTableModel->index(0, 1), 123);
    11. m_pTableModel->setData(m_pTableModel->index(0, 2), "XYZ");
    12. m_pTableModel->setData(m_pTableModel->index(0, 3), "XYZ");
    13. m_pTableModel->setData(m_pTableModel->index(0, 4), "XYZ");
    14.  
    15. m_pTimeTableView->setModel(m_pTableModel);
    To copy to clipboard, switch view to plain text mode 
    If i do this I am getting headers in both horizantal and vertical .. and i am getting one more extra column at last .

    I want to remove Headers and extra columns in the end. How to do this?
    Last edited by jpn; 27th March 2008 at 08:29. Reason: missing [code] tags
    Thanks,
    Rajesh.S

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to remove headers from QTableView.

    i guess u can do something like verticalHeader()->hide() ???

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

    rajeshs (27th March 2008)

  4. #3
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: How to remove headers from QTableView.

    I got solution for removing headers Here : Remove Headers

    How to remove Last extra Column ? and I want to remove Only horizontal Grid ,

    I want Vertical Grid to be shown even if there is no data in the Table . how to do this ?
    Thanks,
    Rajesh.S

  5. #4
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to remove headers from QTableView.

    Create rows as done in docs for QStandardItemModel and see the results then.

  6. #5
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Thumbs up Re: How to remove headers from QTableView.

    I created rows , still i am getting grids,

    If i hide grid using showgrid false. Its removing both horizantal and vertical grid lines , i want to remove only horizontal grid lines ?
    Thanks,
    Rajesh.S

  7. #6
    Join Date
    Jan 2006
    Location
    India
    Posts
    115
    Thanks
    3
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to remove headers from QTableView.

    Quote Originally Posted by rajeshs View Post
    I created rows , still i am getting grids,

    If i hide grid using showgrid false. Its removing both horizantal and vertical grid lines , i want to remove only horizontal grid lines ?
    My reply was regarding extra column problem.

  8. #7
    Join Date
    Jun 2007
    Location
    India/Bangalore
    Posts
    156
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to remove headers from QTableView.

    Thank you . please help me how to remove only horizantal grid lines.
    Thanks,
    Rajesh.S

  9. #8
    Join Date
    Nov 2011
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to remove headers from QTableView.

    I think this can help with the lines. It did for me.

    http://qt.onyou.ch/2010/07/08/hide-v...in-qtableview/

    gg.

  10. The following user says thank you to HaaZzZ for this useful post:

    d_stranz (18th November 2011)

Similar Threads

  1. Remove selected rows from a QTableView
    By niko in forum Qt Programming
    Replies: 4
    Last Post: 3rd March 2016, 12:49
  2. how to remove the span set for a cell in QTableView
    By dandanch in forum Qt Programming
    Replies: 2
    Last Post: 21st October 2008, 11:22
  3. remove node in xml file
    By mattia in forum Newbie
    Replies: 1
    Last Post: 6th March 2008, 13:25
  4. QTableView : headers disappear
    By xavier in forum Qt Programming
    Replies: 2
    Last Post: 8th May 2006, 16:57
  5. QSettings again ... how to remove array elements
    By Mike in forum Qt Programming
    Replies: 4
    Last Post: 11th January 2006, 08:58

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.