Show only application fonts in QFontComboBox?
At the start of my application, I call
and then add some fonts that I want to use.
Is there any way to restrict QFontComboBox to only those fonts?
since it's a ordinary QComboBox you can set your own model to it.
QFontComboBox uses a simple QStringListModel, containign the font names as strings.
Take a look at the Qt source of QFontComboBoxPrivate::_q_updateModel() for further info.
(message too short)
Didn't work. The model is automatically reset to the whole font database in too many places. Since setModel is not virtual, there's also no clean way to override this behavior.
Seems the only way to do this is to write your own widget.