[PyQt] Refreshing QFontDatabase at runtime ?

Hans-Peter Jansen hpj at urpla.net
Sun Feb 5 13:18:46 GMT 2017

On Sonntag, 5. Februar 2017 05:49:48 Gottfried Müller wrote:
> 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.

Your best bet is digging into the Qt sources for that case, I guess..


More information about the PyQt mailing list