[Qt-interest] Font size changes for each OS

David Boosalis david.boosalis at gmail.com
Thu Apr 22 17:18:54 CEST 2010


Silval

Could you not remove all font settings altogether from the application and
then use the default fonts of the system.  Going a step further maybe use
relative font sizes for instance if a label needs to be bigger then the
rest:

QFont fnt = font();
fnt.setPointSize(fnt.pointSize() +2);
label->setFont(fnt);

Or some facsimile of this.  And you can still use bold and italic without
specifying font.


If the code base was built with designer with hard coded fonts and the
application does not always resolve the size of the fonts, then it probable
is using hard coded sizes and geometry values. If this is the case it would
be worth it to switch to using layouts

-David

On Thu, Apr 22, 2010 at 7:41 AM, Silas Silva <silasdb at gmail.com> wrote:

> Hello all,
>
> A badly designed application has fixed-sized widgets and fonts set on Qt
> Designer.  In a machine (with Fedora 9), fonts fit ok, in others (with
> Fedora 12 or Ubuntu) they get bigger.  What could be the cause of this
> problem?  75dpi vs. 100dpi fonts?
>
> I'm not going to discuss about the right and wrong ways of designing Qt
> apps.  This applications is badly designed, yeah, but I inherited this
> maintenance task.
>
> So, I found several links on this list with several solutions:
>
> - Set the application font: this works for the font family but doesn't
>  work for the font size, because they are non-default set in designer.
>
> - Set fonts size with QFont's setPixelSize(): not practical, since there
>  are hundreds of widgets in UI files with hard-coded font sizes.
>
> - Set the font path correctly, so it would pick 75dpi or 100dpi fonts:
>  that is great and I got this idea reading this thread:
>
>  http://lists.trolltech.com/qt-interest/1999-01/thread00076-0.html
>
>  But it doesn't seem to work, even though I just let one path in the
>  font path.  Is there anything I'm missing?
>
> Any clue?  Any tips about how Qt font configuration works with X font
> configuration?
>
> Thanks!
>
> --
> Silas Silva
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100422/e02de9d4/attachment.html 


More information about the Qt-interest-old mailing list