[PyQt] Refreshing QFontDatabase at runtime ?

Gottfried Müller gottfried.mueller at gmx.de
Sun Feb 5 04:49:48 GMT 2017


I wanted to add a font file during the runtime of my program in my user 
font path (Linux: '~/.local/share/fonts'). When I want to use it it is 
not added in the current QFontDatabase. I have to restart my program. It 
does not matter installing the font outside or inside of my program. I 
refreshed also always the font cache with 'fc-cache -f' (inside or 
outside of the program during the runtime). There is no effect. After 
the restart of the program the installed font is available.

I did not find in the Qt documentation any solutions how to refresh the 
QFontDatabase during the runtime of a program. Is it possible anyway? I 
know there exists 'addApplicationFont' from a file. But this is not what 
I want.

Gottfried





More information about the PyQt mailing list