Results 1 to 9 of 9

Thread: Why QStyle dosen't changes the standard font?

  1. #1
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Why QStyle dosen't changes the standard font?

    Hi all, I want to know how to set to the standard font of a specified style (winxp, win, platique,...). I change the style of my app in this way:
    Qt Code:
    1. QApplication::setStyle(QStyleFactory::create("plastique"));
    2. QApplication::setPalette(QApplication::style() -> standardPalette());
    To copy to clipboard, switch view to plain text mode 
    but it only changes the colors to the standard palette of the style (the font is always the windows xp font). I attach an image from Qt docs that shows how is the standard font of each style. I specially want to know the font of the 'plastique' style

    Thanks.
    Attached Images Attached Images

  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: Why QStyle dosen't changes the standard font?

    Styles don't have default fonts associated with them. Take a look at QStyle class.

  3. #3
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Why QStyle dosen't changes the standard font?

    Quote Originally Posted by wysota
    Styles don't have default fonts associated with them. Take a look at QStyle class.
    Yes so it seems, but it's a little strange that when the docs shows a widget in a specified style it's shown with a different font for each style and is always the same for each style, don't you think? I think that the font style should be something related with the app style...

    Does anybody knows which font and metrics is used with plastique style example widgets?
    Last edited by Dark_Tower; 29th March 2006 at 17:52.

  4. #4
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Why QStyle dosen't changes the standard font?

    Quote Originally Posted by Dark_Tower
    Does anybody knows which font and metrics is used with plastique style example widgets?

  5. #5
    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: Why QStyle dosen't changes the standard font?

    Why don't you look at their sources? They probably use the default font for your system.

  6. #6
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Why QStyle dosen't changes the standard font?

    Quote Originally Posted by wysota
    Why don't you look at their sources? They probably use the default font for your system.
    Yes wysota that's exactly what they do and that's exactly the problem. I think that each style sould has assciated its own font style like seem in the docs... Why doesn't?

  7. #7
    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: Why QStyle dosen't changes the standard font?

    Because they were probably taken on different platforms. If you associated a particular font with each style, what would happen if that exact font was not available on the system? You couldn't use that style there.

  8. #8
    Join Date
    Jan 2006
    Posts
    105
    Thanks
    38
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Why QStyle dosen't changes the standard font?

    Quote Originally Posted by wysota
    Because they were probably taken on different platforms. If you associated a particular font with each style, what would happen if that exact font was not available on the system? You couldn't use that style there.
    Sounds a bit harsh wysota. I think that the style could check if the font is present on the system or something. If don't, set the default font...

  9. #9
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Why QStyle dosen't changes the standard font?

    Look at it a different way. When I set the fonts for my system as a whole, I expect ALL applications to abide by it. If I want a special font for a particular application, I can (under Unix at least) use the -font command line option.

Similar Threads

  1. Qt renders wrong font
    By durbrak in forum Qt Programming
    Replies: 8
    Last Post: 2nd November 2006, 15:36

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.