How to find out which fonts are available in qml?

I would like to know which fonts can I use in the environment of QML property font.family . Are these fonts systemic or are they embedded in the structure? Is there a way to list all available fonts?

+6
source share
3 answers

Fonts are systemic, so you should see what your system offers.

If you are using QtCreator :

try placing the mouse pointer at the end of your component name

 Text <here> { ... } 

You should see a yellow light, click on it, and you will have an interface that allows you to select a font.

You can also access the ctrl + alt + space interface inside the component. Or right click.

+7
source

This code will list all the accepted font families:

 ListView { anchors.fill: parent; model: Qt.fontFamilies() delegate: Item { height: 40; width: ListView.view.width Text { anchors.centerIn: parent text: modelData; color: "white" } } } 
+13
source

This is a system list of fonts, but you can specify an external font from resources (QRC)

+4
source

Source: https://habr.com/ru/post/972566/


All Articles