View Full Version : How to prevent table header from font change.

14th February 2007, 09:03
Hi All,

I am designing an application using a Qt Designer. I have a table and I want to change its font. For this i use the setFont(....) Method.

It is perfectly changing the contents of table including headers.

But i don't want the header text to change font. Can some one help me in this regard.

The code segment is as follows.
QFont font = QFontDialog::getFont(
&ok, QFont( "Helvetica [Cronyx]", 10 ), this );
if ( ok ) {
// font is set to the font the user selected
}else {...........}

With Kind Regards

14th February 2007, 19:01
Fonts propagate in Qt3, which means that all child widgets "inherit" the font from its parent (and it's quite logical). If you want to use a different font in a child, you have to set that font specifically for that widget. The header is a widget as well (QHeader), so you can use setFont to set a font for it. Unfortunately you can't do it from within Designer.