title: PyQt4 what is the best way to center dialog windows?
body: <p>When I <code>.show()</code> an dialog it usually shows up a little to the left, I have no idea why. I wanted to center all my opened dialogs so i used:</p>
  
  <pre><code>qr = dlgNew.frameGeometry()
  cp = QtGui.QDesktopWidget().availableGeometry().center()
  qr.moveCenter(cp)
  dlgNew.move(qr.topLeft())
  </code></pre>
  
  <p>and also:</p>
  
  <pre><code>sG = QtGui.QApplication.desktop().screenGeometry()
  x = (sG.width()-dlgMain.width()) / 2
  y = (sG.height()-dlgMain.height()) / 2
  
  dlgMain.move(x,y)
  dlgMain.show()
  </code></pre>
  
  <p>My question is, which is proper/better way to use, and what is the difference?</p>