Important: Please read the Qt Code of Conduct -

How to set a font from a ini file?

  • So? How to set a front from a ini file? Because i have some problems with the qt fonts(because the error: font database cannot find font directory - is qt installed correctly) . So i want use fonts default of system.

    Here what i did:
    Is the folder content with the ttf font. How do i set on my qt project?

    Any tips?

  • @JKSH @SGaist Well, i did this in my code in main.cpp
    QString fontPath = ":/Fonts/Ubuntu-R.ttf";
    int fontId = QFontDatabase::addApplicationFont(fontPath);
    if (fontId != -1)
    QFont font("MyFont");

    It did works, but the error appears, this time only the first line terminal (Before appeared n times). But the program normally performs. Can anyone tell me why the error (FontDatabase) persist?
    Ps.: I build my app with qt libraries STATIC. Exists another way to fix the font problem in the project without this way that i did?

Log in to reply