#include #include #include #include int main(int argc, char *argv[]) { QApplication a(argc, argv); QFont font; font.setStyleHint(QFont::Serif); // QFont::defaultFamily() returns an empty string on Linux qDebug() << font.defaultFamily(); // This is a workaround: if QFontDatabase is instantiated QFont::defaultFamily() returns a non empty string QFontDatabase fdb; // Choose other styleHint than QFont::Serif otherwise the family string would be loaded from the fallback cache font.setStyleHint(QFont::Monospace); qDebug() << font.defaultFamily(); return a.exec(); }