[英]Add a custom font in Qt
There's anyway to add a custom font (Such as Console Font) to Qt? 无论如何要为Qt添加自定义字体(如控制台字体)? How?
怎么样? And how do we set it to a Text Editor (QPlainTextEdit, QTextEdit, etc)?
我们如何将其设置为文本编辑器(QPlainTextEdit,QTextEdit等)?
Thanks 谢谢
Qt uses your window system as a font provider. Qt使用您的窗口系统作为字体提供者。 You can find out all the fonts available by using the QFontDatabase class.
您可以使用QFontDatabase类找到所有可用的字体。 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.
无论如何,可以使用C ++中的QFontDatabase :: addApplicationFont (仅当fontconfig可用时在X11下可用)或在QML中使用FontLoader组件为应用程序添加特定的自定义字体。
For QTextEdit you can use this and for QPlainTextEdit you might try the font property. 对于QTextEdit,您可以使用它 ,对于QPlainTextEdit,您可以尝试使用font属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.