Qt Quick Examples - Text

Image non disponible

Text is a collection of small QML examples relating to text. Each example is a small QML file, usually containing or emphasizing a particular type or feature. You can run and observe the behavior of each example.

Hello

Hello shows how to change and animate the letter spacing of a Text type. It uses a sequential animation to first animate the font.letterSpacing property from 0 to 50 over three seconds and then move the text to a random position on screen:

 
Sélectionnez
            SequentialAnimation on font.letterSpacing {
                loops: Animation.Infinite;
                NumberAnimation { from: 0; to: 50; easing.type: Easing.InQuad; duration: 3000 }
                ScriptAction {
                    script: {
                        container.y = (screen.height / 4) + (Math.random() * screen.height / 2)
                        container.x = (screen.width / 4) + (Math.random() * screen.width / 2)
                    }
                }
            }

Fonts

Fonts shows different ways of using fonts with the Text type. Simply by name, using the font.family property directly:

 
Sélectionnez
            font.family: "Times"

or using a FontLoader type:

 
Sélectionnez
    FontLoader { id: fixedFont; name: "Courier" }

or using a FontLoader and specifying a local font file:

 
Sélectionnez
    FontLoader { id: localFont; source: "content/fonts/tarzeau_ocr_a.ttf" }

or finally using a FontLoader and specifying a remote font file:

 
Sélectionnez
    FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }

Available Fonts

Available Fonts shows how to use the Qt global object and a list view to display all the fonts available on the system. The