目录
Hello
Hello展示了改变字间距和动态展示。使用连续的动画,font.LetterSpacing属性设置,3秒把此属性从0变化到50,并且随机显示在屏幕任意位置。
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展示了使用不同字体的方式,可以使用下面的方式设置:
font.family: "Times"
FontLoader { id: fixedFont; name: "Courier" }
FontLoader { id: localFont; source: "content/fonts/tarzeau_ocr_a.ttf" }
FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" }
Available Fonts
Available Fonts展示了使用Qt全局对象去展示操作系统中的字体,如下:
model: Qt.fontFamilies()
font.family: modelData
Banner
使用NumberAnimation以及一行text构造Banner
Img Tag
在text对象中使用<img>展示不同的图片
Text Layout
对text item使用多个复杂的布局。这里的例子使用了onLineLaidOut去把text放到2列中,并且可以改变位置及改变大小
onLineLaidOut: {
line.width = width / 2 - (margin)
if (line.y + line.height >= height) {
line.y -= height - margin
line.x = width / 2 + margin
}
}
这里后期将会对每一个小知识点提取,形成博文!