Qt Reference Documentation

QML FontLoader Element

The FontLoader element allows fonts to be loaded by name or URL. More...

  • List of all members, including inherited members
  • Properties

    Detailed Description

    The FontLoader element is used to load fonts by name or URL.

    The status indicates when the font has been loaded, which is useful for fonts loaded from remote sources.

    For example:

     import Qt 4.7
     Column {
         FontLoader { id: fixedFont; name: "Courier" }
         FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" }
         Text { text: "Fixed-size font"; font.family: fixedFont.name }
         Text { text: "Fancy font"; font.family: webFont.name }

    See also Fonts example.

    Property Documentation

    name : string

    This property holds the name of the font family. It is set automatically when a font is loaded using the url property.

    Use this to set the font.family property of a Text item.


     FontLoader { id: webFont; source: "http://www.mysite.com/myfont.ttf" }
     Text { text: "Fancy font"; font.family: webFont.name }

    source : url

    The url of the font to load.

    read-onlystatus : enumeration

    This property holds the status of font loading. It can be one of:

    • FontLoader.Null - no font has been set
    • FontLoader.Ready - the font has been loaded
    • FontLoader.Loading - the font is currently being loaded
    • FontLoader.Error - an error occurred while loading the font

    Use this status to provide an update or respond to the status change in some way. For example, you could:

    Trigger a state change:

     State { name: 'loaded'; when: loader.status = FontLoader.Ready }

    Implement an onStatusChanged signal handler:

     FontLoader {
         id: loader
         onStatusChanged: if (loader.status == FontLoader.Ready) console.log('Loaded')

    Bind to the status value:

     Text { text: loader.status != FontLoader.Ready ? 'Not Loaded' : 'Loaded' }


    Thank you for giving your feedback.

    Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.

    [0]; s.parentNode.insertBefore(ga, s); })();