[PyQt] Dialog Window's Position Offset

Brent Villalobos Brent.Villalobos at pdi.dreamworks.com
Tue Oct 13 01:15:08 BST 2009


Thanks for the response Baz.  I'm trying to save a window's position 
when I close a window.  I would think that the position recorded on my 
last move event would be the one recorded on the window's close event.  
The fact that it is not points to an issue either with Qt, PyQt, or my 
window manager.  It isn't a good situation when you can't trust the 
pos() method for a window.  Since you're getting normal results, I'm 
starting to think that the window manager is to blame, not PyQt or Qt.  
FYI, I am on Red Hat Enterprise Linux v5.3 with PyQt v4.4.4 and Qt v4.4.3
-Brent

Baz Walter wrote:
> 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?
>
>
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt


More information about the PyQt mailing list