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
Forum Update on Monday, May 27th 2025

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.
  • M Offline
    M Offline
    MohsenNz
    wrote on 12 Jan 2019, 08:25 last edited by MohsenNz 1 Dec 2019, 08:36
    #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
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 12 Jan 2019, 08:38 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

      1/2

      12 Jan 2019, 08:25

      • Login

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