QML - Text 用于显示文本信息,具有只读属性。
Text可以处理Html格式文本和普通文本,Text默认会尝试把所有的问题放到一行显示。
我们可以通过设置width, height 属性或者设置WrapMode 来改变默认属性。
下面看看他的属性信息。
- baseUrl : url // 指定基准路径,后面的地址信息可以写相对地址
- clip : bool // 指定是否针对宽高信息,剪切到部分内容
- color : color // 文字的颜色
- contentHeight : real // 只读,返回文本宽度
- contentWidth : real // 只读,返回文本高度
- effectiveHorizontalAlignment : enumeration
- elide : enumeration // 当设置了width,指明省略显示不下的内容
-
- Text.ElideNone - 默认,不省略
- Text.ElideLeft - 从左侧省略
- Text.ElideMiddle - 从中间省略
- Text.ElideRight - 从右侧生路
- font.bold : bool // 自体是否加粗
- font.capitalization : enumeration // 设置字母的大小写
-
- Font.MixedCase - 正常,不对之母做大小写修改
- Font.AllUppercase - 全部大写
- Font.AllLowercase - 全部小写
- Font.SmallCaps - 所有字母现实为小型大写字母
- Font.Capitalize - 单词首字母大写
- font.family : string // font family 名字,如”helvetica“
- font.italic : bool // 是否使用斜体
- font.letterSpacing : real // 修改自体间距, 正数正佳间距,负数减少间距
- font.pixelSize : int //
- font.pointSize : real
- font.strikeout : bool
- font.underline : bool
- font.weight : enumeration
- font.wordSpacing : real
- fontSizeMode : enumeration
- horizontalAlignment : enumeration
- lineCount : int
- lineHeight : real
- lineHeightMode : enumeration
- linkColor : color
- maximumLineCount : int
- minimumPixelSize : int
- minimumPointSize : int
- style : enumeration
- styleColor : color
- text : string
- textFormat : enumeration
- truncated : bool
- verticalAlignment : enumeration
- wrapMode : enumeration