PDA

View Full Version : How to use a true type font?



jins
2nd December 2010, 18:08
Hi all

I have searched around and cannot find much on how to set the font of a widget. I would like to set the lineedit widget font to something.ttf (truetype font)

Firstly is this possible on Qt symbian devices such as Nokia and secondley how can i achieve this.

Any help would really be appriciated.

So far i have only tried the below code.


ui->lineEdit->setFont("fancy.ttf");

jins
3rd December 2010, 11:17
I managed to get the font working on the any widget that required it via stylesheets, but i had to copy the font into the font directory of the phone simulator! Now i need to figure out a way in which i can install the font on installation or maybe using a script to copy the font into the font dircetory!

ireas
3rd December 2010, 11:23
You may use the QFontDatabase::addApplicationFont function to load a font from a file. As you want to bring the font with your application, you could use Qt’s resource compiler to store the font file.