Qt文档阅读笔记-Qt Quick Examples - Text 初步解析

196 篇文章 13 订阅
35 篇文章 4 订阅

目录

 

 

Hello

Fonts

Available Fonts

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

 

 

使用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
              }
          }

 

这里后期将会对每一个小知识点提取,形成博文!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IT1995

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值