title: Applying mapToGlobal to main window position
body: <p>Here is some code that creates a single window and, just for fun, lets you click in the window to print <code>self.pos()</code> and <code>self.mapToGlobal(self.pos())</code>:</p>
  
  <pre><code>from PySide import QtGui, QtCore
  
  class WinPosExplore(QtGui.QWidget):
      def __init__(self):
          QtGui.QApplication.setStyle(QtGui.QStyleFactory.create("Plastique"))
          QtGui.QWidget.__init__(self)
          self.show()
  
      def mousePressEvent(self, event):
          if event.buttons() == QtCore.Qt.LeftButton:
              winPos=self.pos() 
              globalWinPos = self.mapToGlobal(winPos)  
              msg1="winPos=self.pos(): &lt;{0}, {1}&gt;\n".format(winPos.x(), winPos.y())
              msg2="self.mapToGlobal(winPos): &lt;{0}, {1}&gt;\n\n".format(globalWinPos.x(), globalWinPos.y())
              print msg1 + msg2
  
  def main():
      import sys
      qtApp=QtGui.QApplication(sys.argv)
      myWinPos=WinPosExplore()
      sys.exit(qtApp.exec_())
  
  if __name__=="__main__":
      main()
  </code></pre>
  
  <p>Because I only am using a single top-level window, I would expect the two sets of coordinates to be the same. That is, I expect the program to realize that for the parent window of the application, <code>mapToGlobal</code> is just the identity function. But this is not what happens. I get different coordinates in ways that are not explicable (by me). For example, the following is one printout:</p>
  
  <pre><code>winPos=self.pos(): &lt;86, 101&gt; 
  self.mapToGlobal(winPos): &lt;176, 225&gt;
  </code></pre>
  
  <p>Can anyone explain what is happening?</p>
  
  <p>Note, I realize this is a silly exercise to some degree (we don't technically ever need mapToGlobal for the main window, as pointed out at <a href="http://www.qtforum.org/article/4482/repositioning-a-window-maptoglobal.html" rel="nofollow">this post at qtforum</a>). But I am still curious if anyone can make sense of this behavior in this corner case.</p>