[PyQt] Subclassed QMainWindow is shown and instantly disappear
Filip Gruszczyński
gruszczy at gmail.com
Mon Dec 29 18:41:02 GMT 2008
I am subclassing QMainWindow to create editors invoked from my browser
application. This goes like this:
action = QAction('Edit', self)
self.connect(action, SIGNAL('triggered()'), resource.invokeEditor)
menu.addAction(action)
for most resources everything is ok and the editor is invoked. But for one:
def invokeEditor(self):
DocumentEditor(self).show()
the editor is first shown and then hidden again. I was using editor
from PyQt examples (a bit changed). But when I tried it for even a
simple one like this:
class DocumentEditor(QMainWindow):
def __init__(self, resource):
QMainWindow.__init__(self)
print "Initializing Document editor"
self.__edit = QTextEdit()
self.setCentralWidget(self.__edit)
I can see, that the editor is invoked, but instantly disappears. I
just can't understand what I am doing suddenly wrong, because for all
other editors (big editor built dynamically from an xml description
and graphical editor for plans) work just fine and never disappear.
What have I forgotten? Do I have to add some parent information?
--
Filip Gruszczyński
More information about the PyQt
mailing list