Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. app.setFont not work in static build Qt

app.setFont not work in static build Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 287 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • MohsenNzM Offline
    MohsenNzM Offline
    MohsenNz
    wrote on last edited by MohsenNz
    #1

    I defined my font in .qrc resources . I wanted to set a default font for my app.
    I am developing a qtqucik application.
    when I build my app normally (in qtqreator) it's work fine.
    but when build my app statically , it don't recognize the font.
    bellow is my code:

    int id = QFontDatabase::addApplicationFont(":/Fonts/Ubuntu-R.ttf");
    QString family = QFontDatabase::applicationFontFamilies(id).at(0);
    QFont ubuntuFont(family);
    app.setFont(ubuntuFont);
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You should read what needs to be done with resources when using static linking: http://doc.qt.io/qt-5/resources.html#using-resources-in-the-application

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      4

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved