TatianaP
TatianaP

Reputation: 187

How to set height of horizontal header QHeaderView?

I need adjust headers of two tables, standing near each other, because headers have different lines of text. It seems impossible.

Please any help!

Upvotes: 0

Views: 3444

Answers (1)

Matthew
Matthew

Reputation: 2829

Create a class derived from QHeaderView and provide your own implementation of sizeHint to return the correct height you would like. i.e.

QSize MyCustomHeaderView::sizeHint() const
{
    // Get the base implementation size.
    QSize baseSize = QHeaderView::sizeHint();

    // Override the height with a custom value.
    baseSize.setHeight( 25 );

    return baseSize;
}

Upvotes: 2

Related Questions