【QT】窗口位置

from

Window Geometry

QWidget provides several functions that deal with a widget’s geometry. Some of these functions operate on the pure client area (i.e. the window excluding the window frame), others include the window frame. The differentiation is done in a way that covers the most common usage transparently.

Including the window frame: x(), y(), frameGeometry(), pos(), and move().
Excluding the window frame: geometry(), width(), height(), rect(), and size().
Note that the distinction only matters for decorated top-level widgets. For all child widgets, the frame geometry is equal to the widget’s client geometry.

This diagram shows most of the functions in use:

一个图说明问题

注意:frameGeometry()获得的是窗体位置,与平台相关;geometry()获得的是QWidget位置。对于frameGeometry(),需要通过QWidget::move(int x, int y)来改变窗口位置,对于geometry(),需要通过setGeometry(int x, int y, int w, int h)来改变窗口位置

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值