Kazuma
Kazuma

Reputation: 1401

Add a custom font in Qt

There's anyway to add a custom font (Such as Console Font) to Qt? How? And how do we set it to a Text Editor (QPlainTextEdit, QTextEdit, etc)?

Thanks

Upvotes: 9

Views: 14611

Answers (1)

Luca Carlon
Luca Carlon

Reputation: 9976

Qt uses your window system as a font provider. You can find out all the fonts available by using the QFontDatabase class. Anyway, it is possible to add a specific custom font for your application to use using QFontDatabase::addApplicationFont from C++ (available under X11 only if fontconfig is available) or using the FontLoader component in QML.

For QTextEdit you can use this and for QPlainTextEdit you might try the font property.

Upvotes: 12

Related Questions