I'm wondering if anyone has an opinion on this? Is this a bug in Qt or
am I not understanding something fundamental?
-Brent
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?
#### Code ####
import sys
from PyQt4 import QtGui, QtCore
myDialog = None
class MyDialog(QtGui.QDialog):
def __init__(self, parent=None):
super(MyDialog, self).__init__(parent)
self.setModal(False)
def moveEvent(self, e):
print "Dialog Moved: ", self.pos()
def closeEvent(self, e):
print "Dialog Closed: ", self.pos()
def showDialog():
global myDialog
myDialog = MyDialog()
myDialog.show()
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
button = QtGui.QPushButton("Show Dialog")
QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), showDialog)
button.show()
sys.exit(app.exec_())
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt