- A+
Widget的pos属性
英文
This property holds the position of the widget within its parent widget
If the widget is a window, the position is that of the widget on the desktop, including its frame.
When changing the position, the widget, if visible, receives a move event (moveEvent()) immediately. If the widget is not currently visible, it is guaranteed to receive an event before it is shown.
By default, this property contains a position that refers to the origin.
中文
此属性保存本界面在其父界面中的位置
如果本界面是窗口,则位置属性是窗口(包括边框)相对于屏幕而言。
当改变位置时,本界面(如果可见)会立即收到移动事件(moveEvent())。如果本界面当前不可见,则保证在显示之前收到事件。
默认情况下,此属性是相对于自身左上角原点的位置。
总结
普通的界面的位置是相对于父界面而言的,pos表示自身在父界面中的位置;但是window类型的界面不一样,这类界面的位置不是相对于父界面,而是相对于屏幕,所以move函数传入的位置参数也是相对于屏幕而言的,不要传错。