Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
JackChiraque last edited by
I'am a total beginner in QT, I'am trying to add a customized font that i can use in my GUI but i couldn't. Any help please? Note that i have already added the font to my Resources file but I don't know what to do next in order to use it.
@JackChiraque Take a look at https://forum.qt.io/topic/57772/using-custom-fonts
JackChiraque last edited by JackChiraque
@jsulm Thanks for your answer, it didn't work for me tho.
I have already added the font to the resources file, but I don't know how to use for a QLabelText
@JackChiraque From the link I posted:
int loadedFontID = QFontDatabase::addApplicationFont ( ":/Triforce.ttf" ); QFont Triforce("Triforce", 24, QFont::Normal); ui->label->setFont(Triforce);
Did you try that?
JonB last edited by
QLabel, has QWidget:setFont(const QFont &). To read a font from resource file, Google for
qfont from resource. there are several hits, maybe https://stackoverflow.com/questions/30973781/qt-add-custom-font-from-resource or https://forum.qt.io/topic/57772/using-custom-fonts.
Then if you'd like to use the font via stylesheet instead of
setFont(), see e.g. https://stackoverflow.com/questions/43411803/how-to-use-a-embedded-font-in-qt-style-sheet.