Results 1 to 2 of 2

Thread: Fonts, Colors, and QStyle

  1. #1
    Join Date
    Jan 2006
    Location
    Edmonton, Canada
    Posts
    101
    Thanks
    13
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Fonts, Colors, and QStyle

    Hello - I am new to QT so please forgive my ignorance, but I am having trouble understanding the relationship between QStyle, colors, and fonts.

    I have read the documentation for QStyle documentation and noted that it contains a method called standardPalette() which lets me set the standard colors for my custom style. I cannot find any methods that will allow me to set fonts for my custom style - is this something I would set in my QStyle object, or does the font belong to the QApplication object outside the style (QApplication::font()) ? I would have thought that font would be part of the style...

    Thanks in advance,

    Jimmy

  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: Fonts, Colors, and QStyle

    A very old thread, but maybe it's worth to answer anyway... The font for QStyle is taken from QPainter object which, as you may see by looking at QStyle reference, is always passed as a parameter for style methods. Therefore the proper way to set the font is to use QApplication::setFont(). Storing the font directly in style wouldn't have much sense, as it could introduce problems with encodings and L-t-R languages.

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.