-
Bug
-
Resolution: Done
-
Not Evaluated
-
None
-
1.1.2
-
None
-
Windows 7 32 bit; Ubuntu 32 bit; Qt 4.8.x
C++ QMdiArea::addSubWindow documentation accepts a generic QWidget and wraps it with a QMdiSubWindow. This appears to also work in PySide with the following serious caveat. I get a segfault in both windows and linux on the following code. After opening and closing the window created in "newkid" 4-50 times. I simply start the program and press Ctrl+F5, Ctrl+W repeatedly activating the QAction and using the platform specific close sub-window shortcut. The nondescript newkid widget appears and disappears until on some open I get a segfault.
#!/usr/bin/env python
from PySide import QtCore, QtGui
class MainWin(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWin, self).__init__(parent)
self.setCentralWidget(QtGui.QMdiArea())
self.myaction = QtGui.QAction("add win", self)
self.myaction.setShortcut("Ctrl+F5")
self.myaction.triggered.connect(self.newkid)
self.addAction(self.myaction)
def newkid(self):
w = QtGui.QWidget()
w.setWindowTitle("hi there")
w.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.centralWidget().addSubWindow(w)
w.showMaximized()
if __name__ == '__main__':
app = QtGui.QApplication([])
w = MainWin()
w.show()
app.exec_()
Both systems are running PySide 1.1.2 and Qt 4.8.x.