As a rule of thumb you should not specify the font sizes for controls manually in Qt Designer/Creator as this leads to the prolems you have. The reason for inconsistency is the fact that different platforms use different DPI settings (96 dpi on Windows vs. 72 DPI on Mac OS X).
This results in fonts being displayed with different sizes.
Also, you mentioned HTML. I assume you have set some HTML text in a QTextEdit
-like widget using the built-in editor. When you select a font size there, Qt Creator will produce some HTML like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans'; font-size:11pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Hello World</p></body></html>
As you can see, it sets some font-size
attributes, which is really nasty. A simple, easy solution to this desaster is to remove the style=
attributes entirely. This causes the QTextEdit
to use the default application font instead (which should be fine on all platforms):
<html><head></head><body><p>Hello World</p></body></html>
As a sidenote, this is much friendlier for translators, as they don't have to fight through all the useless CSS.
Unfortunately Qt's QTextEdit does not support the "percent" font-size specification (just px and pt). If it did, you could have used something like "90%" to make the text smaller than the default font while still being on the safe side.
Another option would be a QWebView, which you make editable. This allows for good text formatting while having the full CSS subset. But that might be overkill.
Hope that helps!