Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104088

QWidget::geometry() and QWidget::mapToParent() documentation is not accurate

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 4.8.7
    • Documentation
    • None

    Description

      https://doc.qt.io/qt-5/qwidget.html#geometry-prop says

      This property holds the geometry of the widget relative to its parent and excluding the window frame

      That's not true if the widget is a window. The documentation doesn't mention that.

      https://doc.qt.io/qt-5/application-windows.html#window-geometry

      No mention of windows either, or if it's relative or absolute coordinates.

      https://doc.qt.io/qt-5/qwidget.html#mapToParent

      Translates the widget coordinate pos to a coordinate in the parent widget.

      Same as mapToGlobal() if the widget has no parent.

      This is also not true if the widget is a window.

      The only documentation (that I found) which addresses this is

      https://doc.qt.io/qt-5/qwidget.html#pos-prop

      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.

      But to even realize that there's a connection, one needs to know that both pos() and geometry() refer to QWidget::data::crect internally.

      I did not check any other methods or properties.

      I found out about this in 4.8.7, but it seems to affect all versions.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            docteam Qt Documentation Team
            ahsyk Andreas Haferburg
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes