Results 1 to 3 of 3

Thread: How to use a true type font?

  1. #1
    Join Date
    Nov 2010
    Posts
    22
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default How to use a true type font?

    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.

    Qt Code:
    1. ui->lineEdit->setFont("fancy.ttf");
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Nov 2010
    Posts
    22
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Windows Symbian S60 Maemo/MeeGo

    Default Re: How to use a true type font?

    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!

  3. #3
    Join Date
    Dec 2010
    Location
    Germany
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: How to use a true type font?

    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.

Similar Threads

  1. Font Height and width based on font size
    By Ghufran in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2010, 08:02
  2. QTabWidget and .setTabsClosable(True)
    By prof.ebral in forum Newbie
    Replies: 3
    Last Post: 26th February 2010, 04:36
  3. Replies: 2
    Last Post: 22nd December 2009, 20:52
  4. Change Font of QListWidget to Monospace Font
    By pospiech in forum Qt Programming
    Replies: 3
    Last Post: 25th July 2008, 18:23
  5. font incorrectly show - font break.
    By sgh in forum Qt Programming
    Replies: 9
    Last Post: 30th May 2008, 02:35

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.