How to find out which fonts are available in qml?

You can improve the previous answer by adding this

Text {
     font.family: modelData
     anchors.centerIn: parent
     text: modelData;
}

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; 
        }
    }
}

The fonts are system-specific so you should see what your system proposes.

If you are using QtCreator :

try putting your mouse over the end of your component name

Text <here> {
    ...
}

You should see a yellow light, click on it and you'll have an interface that allows to choose the font.

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


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

Tags:

Qt

Qml

Qtquick2