Creating QTableWidget Header with multilinetext
-
wrote on 8 Dec 2015, 04:22 last edited by doshirushabh 12 Aug 2015, 04:24
Hello
I was trying to create multiline text in Header of QTableWidget. Nothing worked for me. The Cells can be created with multiline text but header am not sure if there is a simple way. Could anyone help me with thisThanks !!
-
Hello
I was trying to create multiline text in Header of QTableWidget. Nothing worked for me. The Cells can be created with multiline text but header am not sure if there is a simple way. Could anyone help me with thisThanks !!
wrote on 8 Dec 2015, 05:20 last edited by Renn 12 Aug 2015, 05:20@doshirushabh Already tried this yet?
ui->tableWidget->setColumnCount(1);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Something")); -
wrote on 8 Dec 2015, 05:49 last edited by Ratzz 12 Aug 2015, 06:11
Hi and welcome.
You can use\n
to make header with multi-line text. -
@doshirushabh Already tried this yet?
ui->tableWidget->setColumnCount(1);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Something"));wrote on 8 Dec 2015, 06:17 last edited by@Renn
Hello. Thanks but i was able to set single line text like "Something" But Multiline even with \n didnt work. -
@Renn
Hello. Thanks but i was able to set single line text like "Something" But Multiline even with \n didnt work.wrote on 8 Dec 2015, 06:24 last edited by@doshirushabh
I did this waytable->setColumnCount(1); table->setHorizontalHeaderLabels(QString("HEADER 1 \n Header_nextline").split(";"));
-
@doshirushabh
I did this waytable->setColumnCount(1); table->setHorizontalHeaderLabels(QString("HEADER 1 \n Header_nextline").split(";"));
wrote on 9 Dec 2015, 04:04 last edited by@Ratzz
Hello. Thanks for the help. This works . The reason it didnt work is we have some docking undocking and some global settings which didnt make it work when docked. Thanks again !! -
@Ratzz
Hello. Thanks for the help. This works . The reason it didnt work is we have some docking undocking and some global settings which didnt make it work when docked. Thanks again !!wrote on 9 Dec 2015, 04:33 last edited by@doshirushabh
Once your problem is solved please use the Topic Tools button to mark as Solved.
Thank you!
2/7