3

My Qt widget application runs fine on Linux and Windows. On Mac OS X it works, but all fonts appear much smaller (compared to Windows/Linux).

What is the best way to adjust this properly? Some thoughts:

  1. Is there some "secret" parameter I can use to achieve a similar impression? Like Can I set QT_AUTO_SCREEN_SCALE_FACTOR behavior via API? for HI DPI
  2. Is using a style sheet the best way to globally adjust the font for the whole application?
  3. Can I somehow calculate the ratio between Windows/Max OS X fonts so I do know all Windows 8pt fonts have to be 12pt on Mac OS X?
  4. Or is it better to change the font family on Mac OS X (is there a font family giving me the same visual impression as on Windows / Linux)?

Related: I do understand the question has been asked already, but all those refer to much older Qt or Mac OS X versions. So I dare to bring up that topic again.

Edit: Visual impression

Unfortunately I do not have perfect screenshots at hand, but here is how it looks like. The Windows and Linux version are almost pixel identical. The Mac fonts appear too small (MAC OS X right, Windows left), which is the same all over the application (table view, ....)

Windows MacOSX

Currently I do set the fonts via a stylesheet. So the font is 8pt, no pixel size. When I set it to 12pt (trial and error) on Mac OX X the representation is approximately to Windows/Linux.

QWidget {
    color: white;
    font-family: "Arial";
    font-size: 8pt;
    font-style: normal;
    font-weight: bold;
}
Community
  • 1
  • 1
Horst Walter
  • 13,663
  • 32
  • 126
  • 228
  • 1
    It's probably an issue of resolution independence on Retina displays. Somewhere you need to take the window's backing scale factor into account, if Qt is not already doing so. – Dan Korn Jun 23 '16 at 18:56
  • 2
    For clarity's sake, do they not match the platform fonts? Example: are the window titles the wrong size compared to *other* OS X applications? – jonspaceharper Jun 23 '16 at 23:11
  • 1
    I agree with Jon Harper: on OS X, your Qt application will have the default fonts of same size as any native application would. Probably you're setting custom font sizes improperly, but since you show no code, it's hard to tell. You should be using `QFont::setPointSize[F]`, not `QFont::setPixelSize`, for example. – Kuba hasn't forgotten Monica Jun 23 '16 at 23:58
  • Updated as requested – Horst Walter Jun 24 '16 at 00:41

0 Answers0