Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Qt Academy Launch in California!

    Solved How to use a custom font in Qt Installer Framework?

    General and Desktop
    qt installer custom font font qtinstaller
    1
    2
    176
    Loading More Posts
    • 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.
    • SamurayH
      SamurayH last edited by SamurayH

      Hi,
      I'm trying to use a custom font for my installer by it doesn't work.
      In the documentation of binarycreator they say that : "In the optional resource files specified via the --resources parameter, a special fonts/ path can be used to ship custom fonts. . These fonts will be loaded automatically and thus become available in a stylesheet which can be specified via the StyleSheet variable."

      So I'm using the following command to build the installer:

      binarycreator -c config\config.xml -p packages MyAppSetup.exe -r ./fonts/;
      

      and I set the font like this (in config/style.qss):

      QWidget {
          background-color: #323232;
          color: #e6e6e6;
          font: 9pt  'MyFont'; 
      }
      

      however the installer doesn't display the correct font unless it's already installed in the system.

      I'm assuming it's a bug, but not sure, any ideas?

      "قال رسول الله صلى الله عليه وسلم : " أحب الناس إلى الله أنفعهم للناس

      1 Reply Last reply Reply Quote 0
      • SamurayH
        SamurayH last edited by

        Ok I've solved it.
        It was my fault, the -r parameter must have a list of Qt Resource files..
        I got a bit confused with the fonts/ path, I though it was a folder but it's a prefix path a Qt Resource file (.qrc):

        <RCC>
            <qresource prefix="/fonts">
                <file>MyFont.TTF</file>
            </qresource>
        </RCC>
        

        and the command:

        binarycreator -c config\config.xml -p packages -r resources/rc.qrc MyAppSetup.exe
        

        "قال رسول الله صلى الله عليه وسلم : " أحب الناس إلى الله أنفعهم للناس

        1 Reply Last reply Reply Quote 0
        • First post
          Last post