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:

【QT】窗口位置

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

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-10
  • 2021-06-15
  • 2021-07-08
  • 2022-12-23
猜你喜欢
  • 2021-06-21
  • 2021-09-08
  • 2021-07-30
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案