title: Qt place new window correctly on screen, center over mouse, move into screen
body: <p>After many months of trying, searching, reviewing code, etc. I'm unable to find a solution to properly positioning a new window in QT. In my most basic case I simply want to get the final size of the window and center it under the mouse. It will be shifted to ensure that no part of the window is outside of the screen. I do not wish to have the window appear then move into position, that produces visual jarring, particularly with desktop FX turned on.</p>
  
  <p>The problems I've encountered, not all of which have proper solutions:</p>
  
  <ol>
  <li><p>frameGeometry is not always populated before the window has been shown before.</p></li>
  <li><p>frameGeometry is sometimes just completely wrong, in particular on Windows 7.</p></li>
  <li><p>Prior to display it is not possible to know whether sizeHint or size will be applied, or something else in between. That is, the size policy does not appear predictable.</p></li>
  </ol>
  
  <p>Note that I know how to save/restore geometry of a previously created window. Despite QT defects here as well I have a working solution.</p>
  
  <p>Also note that I cannot use the window manager default placement. For non-MDI apps on a multi-monitor setup their placement is terrible (often not even being on the same monitor as the mouse).</p>
  
  <p>I'd also like to avoid sub-classing all widgets and dialogs just to implement the solution, as it would not be generic. If this is the only possible way then I'd be willing to consider it (should event filters also not be an option).</p>
  
  <p>Does anybody have good workable solutions?</p>