qss font-family not working

  • Hi,

    After updating to Qt 5.13 I can't use the fonts I added with QApplication::addApplicationFont in my stylesheet anymore.
    Previously I could do something like:

    QWidget {
        font-family: some-font, Arial;

    and it would use "some-font".
    Now in Qt 5.13 it falls back to Arial in this case.
    The return value of QApplication::addApplicationFont is greater than -1 and I can query the family just fine.

    Any idea what's wrong?

  • It's really weird because if I remove the fallback to Arial then it at least uses the proper family. Although it's still not the exact look as it was before.

  • Lifetime Qt Champion


    Looks like it could be a regression. Did you already check the bug report system ?

  • @sgaist I created a bug ticket.

    Btw. is there an alternative to qss files and how difficult would it be to implement.
    This would need to support custom styles that can be loaded by users just like qss files

  • Lifetime Qt Champion

    Please post the link to the report so other users may find it more easily.

    Well, you would have to implement your own QStyle sub-class and write a parser that would translate your custom styling language in something that you can paint the way you want it.

    You can take a look at the internal QStylesheetStyle class that does that for Qt's style sheet system.

Log in to reply