Hello there,
I am using a QTableView. One of the calls I'm making to the QTableView is this:
mTableView->horizontalHeader()->setFont( someFont );
mTableView->horizontalHeader()->setFont( someFont );
To copy to clipboard, switch view to plain text mode
I had noticed that if I used a large sized font, the header would be too short to display its text, so I overrode the header's setFont method in the following way:
void GridHeader
::setFont( const QFont & aFont
) {
int bufferSize = height() - fontMetrics().height();
this->QHeaderView::setFont( aFont );
setFixedHeight( fontMetrics().height() + bufferSize );
}
void GridHeader::setFont( const QFont & aFont )
{
int bufferSize = height() - fontMetrics().height();
this->QHeaderView::setFont( aFont );
setFixedHeight( fontMetrics().height() + bufferSize );
}
To copy to clipboard, switch view to plain text mode
This works like I was hoping it would - the header's height changes as the font height changes. The problem I'm encountering now is that the rest of the QTableView doesn't seem to recognize the header's height change. As a result, the first rows of the table are hidden by the header if the header's height increases.
Is there some signal the header should be emitting when it changes height? How can I get the grid to resize properly when the header size changes?
Jimmy
Bookmarks