在Qt中添加一个自定义字体 [英] Add a custom font in Qt
问题描述
怎么样?我们如何将它设置为文本编辑器(QPlainTextEdit,QTextEdit等)?
谢谢
Qt使用您的窗口系统作为字体提供程序。您可以使用 QFontDatabase 类找到所有可用的字体。无论如何,可以使用 QFontDatabase为您的应用程序添加特定的自定义字体:: addApplicationFont (只有在fontconfig可用的情况下才可在X11下使用)或使用 FontLoader 组件在QML中。
对于QTextEdit,您可以使用这个,对于QPlainTextEdit,你可以尝试字体属性。
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
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.
这篇关于在Qt中添加一个自定义字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!