Results 1 to 1 of 1

Thread: addapplicationfont always returns -1

  1. #1
    Join Date
    Jun 2011
    Posts
    25
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: addapplicationfont always returns -1

    Hi,

    I have a strange problem with loading of embedded fonts:
    actally i have 2 applications:
    1) GUI application with qt-4.7.2
    2) QML application with qt-4.8.4

    In both applications i try to load embedded font "Calculator" in this way:
    • Added "fonts" directory
    • Added "Calculator.ttf" font to directory
    • Added resources "fonts.qrc" inside "fonts" directory with prefix "/fonts"
    • Added file "Calculator.ttf" to fonts.qrc and added alias "Calculator".
    • In application main added follow lines:
      Qt Code:
      1. int id = QFontDatabase::addApplicationFont( ":/fonts/Calculator" );
      2. qDebug() << "id value=" << id;
      To copy to clipboard, switch view to plain text mode 


    in GUI application (#1) I have "id value= 0"
    in QML application (#2) I have "id value= -1"

    What's can be wrong in QML application?

    ps. I've also try to add font without using resources but does not work too.


    Added after 47 minutes:


    Update: seems to be a problem of (my) Qt 4.8.4 installation because I've tried to use qt-4.7.2 in QML project and fonts is added correctly.
    Last edited by nick85; 17th July 2013 at 11:08.

Similar Threads

  1. Replies: 5
    Last Post: 20th June 2012, 23:40
  2. Replies: 1
    Last Post: 27th October 2011, 21:49
  3. addApplicationFont() doesn't work for all fonts
    By chritz in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 8th August 2011, 10:10
  4. Replies: 3
    Last Post: 5th August 2011, 23:19
  5. app.exec() never returns?
    By stealth86 in forum Qt Programming
    Replies: 3
    Last Post: 17th July 2007, 18:41

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.