Creating QTableWidget Header with multilinetext
-
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 !!
@doshirushabh Already tried this yet?
ui->tableWidget->setColumnCount(1);
ui->tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem("Something")); -
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"));@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.@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(";"));
@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 !!@doshirushabh
Once your problem is solved please use the Topic Tools button to mark as Solved.
Thank you!