[Qt-interest] Table header text

Anatoly Burakov burakov.anatoly at googlemail.com
Mon May 18 22:22:16 CEST 2009


Hello everyone!

I'm kinda new to QT4 (and not at all an experienced programmer) and i
got a question.

I am writing a program with MDI. An MDI window gets open after a menubar
item was clicked. The QMdiSubWindow has a QTableWidget as a central
widget. Basically, i am trying to change column headers' text. It works
fine if i do like this:

QStringList headerList;
headerList << "Header";

tableWidget.setHorizontalHeaderLabels(headerList);


but if i create each column header individually - it does not change
header labels:

tableWidget.setColumnCount(1);

tableWidget.setRowCount(0);

QTableWidgetItem column;

column.setText("Header");

tableWidget.setHorizontalHeaderItem(0, &column);


I would be grateful for any help. I use Qt Creator 1.1.0 (QT version 4.5.1).

Thank you,
Anatoly



More information about the Qt-interest-old mailing list