PDA

View Full Version : Font size increase in QtableWidget



sosanjay
19th November 2009, 11:46
Hi,

I want to increase the font size of the QTableWidget.


QFont fnt;
fnt.setPointSize(30);
fnt.setFamily("Arial");
ui->tableWidget->setFont(fnt);


Can anyone suggest me Why it is not working?

Is setPointSize(30) is correct for font size or any other options.

kichi
19th November 2009, 14:51
If you specified item's font already, QTableWidget's font is ignored.

You can change the font size as follows.


QFont fnt;
fnt.setPointSize(30);
fnt.setFamily("Arial");
const int rowCount = tableWidget->rowCount();
const int columnCount = tableWidget->columnCount();

for(int i = 0; i < rowCount; ++i) {
for(int j = 0; j < columnCount; ++j) {
QTableWidgetItem* selectedItem = tableWidget->item(i, j);
selectedItem->setFont(fnt);
}
}

I'm sorry in poor English.