[PyQt] Dialog Window's Position Offset

Baz Walter bazwal at ftml.net
Sat Oct 10 13:48:33 BST 2009

Brent Villalobos wrote:
> I'm wondering if anyone has an opinion on this?  Is this a bug in Qt or 
> am I not understanding something fundamental?
> Brent Villalobos wrote:
>> I'm confused about the position of dialogs that do not have parents.  
>> I wrote a small PyQt application that is a push button that launches a 
>> non-modal, non-parented QDialog.  When you show the dialog and then 
>> close it without explicitly moving it, then it reports the wrong 
>> position.  However, the position gets reported just fine on close if I 
>> move the dialog box.
>> If you run my test code (shown below), you get this output when you 
>> push the "Show Dialog" button and then close the dialog right away 
>> (your actual values may differ):
>> Dialog Moved:  PyQt4.QtCore.QPoint(2075, 336)
>> Dialog Moved:  PyQt4.QtCore.QPoint(1600, 336)
>> Dialog Closed:  PyQt4.QtCore.QPoint(1595, 312)
>> The position on close is always offset by (-5, -24).  Why?  Will those 
>> offset values always be the same or is there a way I can query for 
>> those offset values?

it looks like this might be a platform-specific window manager issue.

on my linux box (mandriva 2009.1, kde 4.2.4, qt 4.5.2, pyqt 4.4.4), i 
get the following output when running your code:

Dialog Moved:  PyQt4.QtCore.QPoint(0, 0)
Dialog Moved:  PyQt4.QtCore.QPoint(0, 0)
Dialog Closed:  PyQt4.QtCore.QPoint(0, 0)

it would help if you explained more clearly what you were trying to achieve.

also, what happens if you move(0,0) the dialog before you show() it? do 
you still see an offset when the dialog is closed?

More information about the PyQt mailing list