PDA

View Full Version : Why QStyle dosen't changes the standard font?



Dark_Tower
29th March 2006, 13:01
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:

QApplication::setStyle(QStyleFactory::create("plastique"));
QApplication::setPalette(QApplication::style() -> standardPalette());
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.

wysota
29th March 2006, 16:13
Styles don't have default fonts associated with them. Take a look at QStyle class.

Dark_Tower
29th March 2006, 16:41
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?

Dark_Tower
30th March 2006, 12:50
Does anybody knows which font and metrics is used with plastique style example widgets?

:confused:

wysota
30th March 2006, 13:18
Why don't you look at their sources? They probably use the default font for your system.

Dark_Tower
30th March 2006, 13:22
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?

wysota
30th March 2006, 15:25
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.

Dark_Tower
30th March 2006, 15:43
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... ;)

Brandybuck
31st March 2006, 02:49
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.