Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.15.0
-
None
-
Have tested on:
1. Arch Linux with KDE Plasma 5.19.1 and Xorg.
2. Windows 10.
Description
If a QFont is created without explicitly specifying the point size, its actual point size is the same as the system font, but when calling QFont:pointSize, 12 is returned no matter what the size of the system font (i.e. the actual size) is.
A minimal way to reproduce it:
#include <QApplication> #include <QTextEdit> int main(int argc, char *argv[]) { QApplication app(argc, argv); QTextEdit edit1, edit2; QFont font1("monospace"), font2("monospace", 12); edit1.setFont(font1); edit2.setFont(font2); edit1.setPlainText(QString("size of font1: %1\nfont size of edit1: %2").arg(font1.pointSize()).arg(edit1.font().pointSize())); edit2.setPlainText(QString("size of font2: %1\nfont size of edit2: %2").arg(font2.pointSize()).arg(edit2.font().pointSize())); edit1.show(); edit2.show(); return app.exec(); }
The screenshot of the above code executed on Arch Linux with KDE Plasma is attached.