Results 1 to 2 of 2

Thread: header for tableView of QStandardItemModel

  1. #1
    Join Date
    Jan 2015
    Posts
    8
    Thanks
    7
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default header for tableView of QStandardItemModel

    Hi there,

    I use QStandardItemModel and want to add header text to my tableView. I thought I have to use "setHorizontalHeaderLabels", however "ui->tableView" doesn't give such a method.

    the data for tableView are a child of my model (let say tableView shows children of "model->item(0,0)").

    is it right to use:
    model->setHeaderData(0, Qt::Horizontal, tr("Name"));


    anyone can help?

    Thanks,
    Omid

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: header for tableView of QStandardItemModel

    Last edited by d_stranz; 10th February 2015 at 00:21.

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

    Omid123 (12th February 2015)

Similar Threads

  1. Text orientation in header from QStandardItemModel
    By Tondog in forum Qt Programming
    Replies: 3
    Last Post: 2nd October 2012, 08:39
  2. Change tableView vertical header
    By tinysoft in forum Newbie
    Replies: 1
    Last Post: 17th September 2011, 08:35
  3. QStandardItemModel to TableView
    By uygar in forum Qt Programming
    Replies: 7
    Last Post: 23rd May 2011, 23:52
  4. TableView with header and footer for sums, avg and so on
    By extreme001 in forum Qt Programming
    Replies: 0
    Last Post: 18th April 2011, 20:56
  5. Replies: 3
    Last Post: 1st February 2008, 18:18

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.