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.
Simply use the setFont() method on the QApplication or QWidget : QFont font("Courier New"); font. setStyleHint(QFont::Monospace); QApplication::setFont(font);
To set your computer's displayed font size to default: Browse to: Start>Control Panel>Appearance and Personalization>Display. Click Smaller - 100% (default).
1em is equal to the current font size. The default text size in browsers is 16px. So, the default size of 1em is 16px.
[16 pixels] is not big. It's the text size browsers display by default. It's the text size browsers were intended to display… It looks big at first, but once you use it you quickly realize why all browser makers chose this as the default text size.
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.
Get a default font QFont object and read the size from it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With