Results 1 to 2 of 2

Thread: QTableWidget custom header labels

  1. #1
    Join Date
    Apr 2011
    Posts
    132
    Thanks
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTableWidget custom header labels

    I am trying to put labels instead of default labels, but this does not work for me, still seeing the numbers instead.

    Qt Code:
    1. QStringList headerLabels;
    2. headerLabels << "Title" << "Genre" << "Artist" << "Rating";
    3. this->setHorizontalHeaderLabels(headerLabels);
    4. this->resizeColumnsToContents();
    5. this->setColumnCount(4);
    To copy to clipboard, switch view to plain text mode 


    example from:
    http://doc.qt.nokia.com/latest/itemv...rdelegate.html
    Last edited by wysota; 1st June 2011 at 09:20. Reason: missing [code] tags

  2. #2
    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: QTableWidget custom header labels

    Set column count first and then set the labels.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    migel (1st June 2011)

Similar Threads

  1. Setting two horizontal header labels for QTablewidget
    By arunvv in forum Qt Programming
    Replies: 2
    Last Post: 20th August 2009, 17:58
  2. combo box in Header of QTableWidget
    By sar_van81 in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2008, 16:58
  3. QSlider with a custom set of labels for the tick marks?
    By whitefurrows in forum Qt Programming
    Replies: 3
    Last Post: 5th August 2007, 16:05
  4. QTableWidget, header behavior
    By hyling in forum Qt Programming
    Replies: 1
    Last Post: 14th October 2006, 08:03
  5. Replies: 1
    Last Post: 23rd August 2006, 18:02

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.