To get Qt widget position,we can call function such as:
geometry(),pos(),x(),y(),width(),height()
The difference between geometry() with pos(),x(),y(),width(),height() below:
when we call geometry(),this will return a QRect,it indicates the widget position exclude window frame,but size with them(designed in QtDesigner).
when we call x(),y(),they will return the widget x-coordinate and y-coordinate include window frame.
when we call pos(),this will return the widget position within its parent.
when we call width(),height(),exclude the window frame.
**
but pay attention:all these functions will return value relative to their parent,so,to QMainWindow,these functions will return its postion relative to the desktop,but to other sub-widgets ,these functions always return the value relative to their parent widget
**
the diagram below: