When setting a font in a Qt
application, where can I find the list of fonts I can choose from?
Thanks.
Qt normally uses fontconfig to provide access to system fonts. If fontconfig is not available, e.g. in dedicated embedded systems where space is at a premium, Qt will fall back to using QBasicFontDatabase . In this case, Qt applications will look for fonts in Qt's lib/fonts/ directory.
To do this in Qt Creator right click on your project and click Add New, then select Qt / Qt Resource File (*. qrc file) and give it any names you want. As it is seen in the picture, I created a resource file named “resources. qrc”, and added a prefix named “fonts” and then added the font file named “komika_font.
The QFont class specifies a query for a font used for drawing text.
You can use the QFontDatabase
class to get information about available fonts in the underlying window system.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With