2020-10-27

QML基础知识

 

bool

布尔值 true/false

double

双精度数字类型

enumeration

枚举

int

整型

list

QML 对象列表

real

实型(C++中 float)

string

字符串类型

url

资源定位器

var

通用属性类型

var:通用的属性,可以涉及任何数据类型,类似于c语言的void类型。

Item {

    property var aNumber: 100

    property var aBool: false

    property var aString: "Hello world!"

    property var anotherString: String("#FF008800")

    property var aColor: Qt.rgba(0.2, 0.3, 0.4, 0.5)

    property var aRect: Qt.rect(10, 10, 10, 10)

    property var aPoint: Qt.point(10, 10)

    property var aSize: Qt.size(10, 10)

    property var aVector3d: Qt.vector3d(100, 100, 100)

    property var anArray: [1, 2, 3, "four", "five", (function() { return "six"; })]

    property var anObject: { "foo": 10, "bar": 20 }

    property var aFunction: (function() { return "one"; })

}

font:字体属性

string font.family    // 字体的名字,字体类型

bool font.bold        // 是否使用粗体

bool font.italic      // 是否使用斜体

bool font.underline   // 是否使用下划线

real font.pointSize   // 设定字体大小 (1pt = 0.3527mm)

int font.pixelSize    // 设定字体大小, 当 pointSize 和 pixelSize 都设定了,那么使用pixelSize

enumeration font.weight // 设置文本的粗细 (可以选择的范围是0-99)

bool font.overline    // 设置文字上方是否划线

bool font.strikeout  // 设置文字是否使用strikeout 风格

enumeration font.capitalization  // 设定文字的大小写属性,(如果有大小写之分的话)

real font.letterSpacing // 修改默认的字符间隔,可以是负数,如果是负数减少间隔

real font.wordSpacing  //修改默认的词间隔,可以是负数,如果是负数减少间隔

font.MixedCase - 按照正常显示,不修改大小写

font.AllUppercase - 所有都大写

font.AllLowercase - 所有都小写

font.SmallCaps - 修改首字母为小写

font.Capitalize - 修改首字母为大写

 

color:设置颜色属性,颜色的设置有3种方式

Text {

    color: "red"           //设置为红色字体

}

Rectangle {

    color: "#800000FF"     // AARRGGBB fully transparent

    y: 120; width: 40; height: 40

}

Rectangle {

    color: "#FF0000"    // RRGGBB fully transparent

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值