I'm learning QT and have to design a table like this
I need "m2" with "2" as superscript.
Here is my code:
ui.tableWidget->horizontalHeaderItem(0)->setText("Date");
ui.tableWidget->horizontalHeaderItem(0)->setBackgroundColor(QColor(217, 217, 217));
ui.tableWidget->horizontalHeaderItem(1)->setText("House address");
ui.tableWidget->horizontalHeaderItem(1)->setBackgroundColor(QColor(217, 217, 217));
ui.tableWidget->horizontalHeaderItem(2)->setText("Area \n [m\u00B2]");
ui.tableWidget->horizontalHeaderItem(2)->setBackgroundColor(QColor(217, 217, 217));
ui.tableWidget->horizontalHeaderItem(3)->setText("Price \n [USD]");
ui.tableWidget->horizontalHeaderItem(3)->setBackgroundColor(QColor(217, 217, 217));
ui.tableWidget->horizontalHeaderItem(4)->setText("Price/Area \n [USD/m\u00B2]");
ui.tableWidget->horizontalHeaderItem(4)->setBackgroundColor(QColor(217, 217, 217));
I used "\u00B2" for "2" as superscript but it doesn't work, the background color also does not change. Please help me, many thanks !