bound与clientarea区别

bounds指边界范围。

clientarea指窗口的显示区域(即放置 子控件的有效区域),一般而言clientarea小于bounds。只有Composite等一些容器类才有ClientArea的说法。一般控件没有。


获取某控件的bounds:getBounds
由于布局有spacing,margin等:所以,很多时候x,y坐标可能不是0,clientarea也相较bounds的width,height小几个像素。

如,某个容器(comp使用的是RowLayout布局。)的ClientArea为
comp ClientArea: Rectangle {0, 0, 54, 28}

但里面放置的button的bounds为(只放置了button一个控件):
button: Rectangle {3, 3, 48, 22}

是因为RowLayout布局默认有上下,左右的margin。
comp marginTop: 3
comp marginHeight: 0
comp marginBottom: 3
comp marginLeft: 3
comp marginWidth: 0
comp marginRight: 3

上下相加,左右相加正好为6像素。button的width,height加上6个像素刚好为comp的clientArea
的width和height

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值