-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.0
-
None
-
Linux x64
The following code snippet results an empty string:
QFont font;
font.setStyleHint(QFont::Serif);
qDebug() << font.defaultFamily();
The issue seems to be Linux specific. I tested it on Windows where QFont::defaultFamily() works as expected. During debugging I found that QGuiApplicationPrivate::platformIntegration()>fontDatabase()>fallbacksForFamily() call always returns an empty list.
As a workaround QFontDatabase can be instantiated before the QFont::setStyleHint() call. That's why the corresponding auto test (tst_QFont::defaultFamily() in tests/auto/gui/text/qfont/tst_qfont.cpp) doesn't detect this issue.
This feature must have worked before because QtWebKit had an auto test which tested this. Currently this test is skipped in QtWebEngine.