Results 1 to 2 of 2

Thread: How to prevent table header from font change.

  1. #1
    Join Date
    Feb 2007
    Posts
    22
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default How to prevent table header from font change.

    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
    table1->setFont(font);
    }else {...........}

    With Kind Regards
    Kenny

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to prevent table header from font change.

    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.

Similar Threads

  1. Showing Icon in vertical header of a table
    By vishal.chauhan in forum Qt Programming
    Replies: 7
    Last Post: 15th January 2007, 10:44
  2. Editable table header
    By cmaxb in forum Qt Programming
    Replies: 1
    Last Post: 9th December 2006, 12:12
  3. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16
  4. Change Font Color of Label and CheckBox
    By mahe2310 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 15th June 2006, 10:24
  5. Change font in QPainter::drawText
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 19th May 2006, 16:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.