I know it seems a stupid question, but I cannot find how to change QTableWidget header name or text.
Any idea?
Thanks.
I know it seems a stupid question, but I cannot find how to change QTableWidget header name or text.
Any idea?
Thanks.
take a look at QTableWidget::setHorizontalHeaderLabels and QTableWidget::setHorizontalHeaderItem (in this case you can use QTableWidgetItem::setText).
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
Thanks.
ui.tableWidgetTextureLibrary->setHorizontalHeaderItem(0, new QTableWidgetItem("Prueba"));
Worked
But this one
ui.tableWidgetTextureLibrary->horizontalHeaderItem(0)->setText("Whatever");
Doesn't work.
I mena, instead of creating a new QTableWidgetItem, can I edit the current one?
Thanks.
yes, you can. but at first you have to add an item, because if you don't do this your programm will crash if you use this code:
so, if you already created an item like thisQt Code:
ui.tableWidgetTextureLibrary->horizontalHeaderItem(0)->setText("Whatever");To copy to clipboard, switch view to plain text mode
then in you code you can use horizontalHeaderItem for changing column name, because horizontalHeaderItem will return valid pointer.Qt Code:
To copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
ricardo (14th May 2009)
Bookmarks