vendredi 8 mai 2015

How to embed a custom font in my application

I want to add a custom font to my application, and I have already added to my resource file.

And my code as the following:

int id = QFontDatabase::addApplicationFont(":/fonts/ae_AlMateen.ttf");
QMessageBox::information(this,"Message",QString::number(id));

But the problem is that the addApplicationFont always returns -1.

Note that when change the :/fonts/ae_AlMateen.ttf to direct path ex:C://ae_AlMateen.ttf it works fine.

I dont know what is the problem.

Aucun commentaire:

Enregistrer un commentaire