Qt Widget Pos - Qt空间位置

了解如何获取Qt小部件的位置,可以使用geometry(), pos(), x(), y()等函数。geometry()返回不包含窗口边框的矩形位置,x(), y()返回包含边框的坐标,pos()返回相对于父组件的位置,width(), height()则不包括窗口边框。注意所有这些函数返回的是相对于其父组件的值。" 123005416,9467809,phpmyadmin安全风险与getshell技巧,"['web安全', '数据库', 'php', 'phpmyadmin漏洞']

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

To get Qt widget position,we can call function such as:

 geometry(),pos(),x(),y(),width(),height()

The difference between geometry() with pos(),x(),y(),width(),height() below:

when we call geometry(),this will return a QRect,it indicates the widget position exclude window frame,but size with them(designed in QtDesigner).

when we call x(),y(),they will return the widget x-coordinate and y-coordinate include window frame.

when we call pos(),this will return the widget position within its parent.

when we call width(),height(),exclude the window frame.

**

  but pay attention:all these functions will return value relative to their parent,so,to QMainWindow,these functions will return its postion relative to the desktop,but to other sub-widgets ,these functions always return the value relative to their parent widget

**


the diagram below:



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值