Qt文档阅读笔记-Qt Quick Examples - Text 初步解析
生活随笔
收集整理的這篇文章主要介紹了
Qt文档阅读笔记-Qt Quick Examples - Text 初步解析
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
目錄
?
?
Hello
Fonts
Available Fonts
Banner
Img Tag
Text Layout
?
?
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 - marginline.x = width / 2 + margin}}?
這里后期將會對每一個小知識點提取,形成博文!
總結
以上是生活随笔為你收集整理的Qt文档阅读笔记-Qt Quick Examples - Text 初步解析的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Spring Boot中@Configu
- 下一篇: Java笔记-spring boot支持