开发者

QFontCombobox (Qt 4.7) missing fonts

开发者 https://www.devze.com 2023-02-04 04:21 出处:网络
I am developing a Qt application and i am using a QFontCombobox that must list all fonts,the application will be used by designers and they have a lot of fonts installed. I was notified that many font

I am developing a Qt application and i am using a QFontCombobox that must list all fonts,the application will be used by designers and they have a lot of fonts installed. I was notified that many fonts are missing in the combobox. I read the documentation and the comb开发者_如何学运维obox by default should load all fonts. I need a solution or at least some tips about why fonts could be missing and how could I load them. The application must be cross-platform so it would be better to avoid calling native libs if possible.


You can use

QStringList QFontDatabase::families ( WritingSystem writingSystem = Any ) const

function to see what font families are recognized by Qt. If the list is somehow incomplete you can add fonts with

int QFontDatabase::addApplicationFont ( const QString & fileName ) [static]

function.


The QFontCombobox does not display fonts but font families. See the Font Sampler example in qtdemo/Painting for how to enumerate all fonts in a tree.

0

精彩评论

暂无评论...
验证码 换一张
取 消