How to use a custom font in Qt Installer Framework?



  • 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?



  • 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