How to set font size to horizontal header of QTableView
-
Hi,
I tried to find solution for this on google but I couldn't.
I tried set font size in both code and stylesheet but they don't work:
@ui->tblView->horizontalHeader()->setFont(QFont("Tahoma", 20));@
@QTableView#tblView QHeaderView::section:horizontal
{
font-size: 20px;
font-family: "Tahoma";
}@Please help, thanks.
-
Hi Andre,
I will try and report back to you. Thank you.
-
Hi Andre,
I tried to find some relevant data role in QAbstractItemModel::headerData and thought that FontRole can help me. But nothing's change even I used FontRole
@QVariant UploadedTableModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role == Qt::FontRole)
return QFont("Tahoma", 14);
...
@Maybe I miss something else. Can you please advice?