12

Qt uses 9px as default font size, but users (on Linux) can change this by using qtconfig.

So, how do I get the system default font size? I read the documents, but I can not find any API.

比尔盖子
  • 2,693
  • 5
  • 37
  • 53
  • 3
    This answer might be of some help. http://stackoverflow.com/questions/11011238/how-do-you-get-system-default-font-settings-in-qt – Jan Bodnar Mar 02 '13 at 15:12

2 Answers2

9

Get a default font QFont object and read the size from it.

ypnos
  • 50,202
  • 14
  • 95
  • 141
4

Your application default font can be obtained from QApplication::font(), which

Returns the default application font.

And you can gather a size of it using pointSize(),pointSizeF(),pixelSize(), etc.

PolyGlot
  • 740
  • 6
  • 11