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().
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().
frameGeometry() 在没有显示过的情况下,第一次调用该函数时返回的大小是没有Frame的,和rect 的返回值一样。
为了避免这个问题,可以在对象的构造函数中先调用一次show,再紧接着调用一次hide,这样这个对象就有了 Frame的信息了。