conflict between QWidget (window) and mainWindow
-
Hi, i'am new of Pyqt4.
In my project when the window lose the focus and i try to click a MenuButton in mainWindow, the project crash!!! Why? Please help me!!
this is my mainWindow code:
@
help = QAction(self.getIcon(QStyle.SP_MessageBoxQuestion), 'Help', self)
self.connect(help, QtCore.SIGNAL('triggered()'), self.helpAction)def helpAction(self):
a = Help()
a.init()
@and this is my Widget code:
@
class Help(QtGui.QWidget):
def init(self):
QtGui.QWidget.init(self)
self.setWindowTitle(' Help')
self.setWindowIcon(QtGui.QIcon('icons/help.png'))
ok = QtGui.QPushButton("Close", self)
self.connect(ok, QtCore.SIGNAL('clicked()'), QtCore.SLOT('hide()'))
about = QtGui.QTextBrowser(self)
about.setMinimumSize(400, 400)
about.setSource(QtCore.QUrl('help.html'))
grid = QtGui.QGridLayout(self)
grid.setSpacing(7)
grid.addWidget(about, 2, 0, 5, 3)
grid.addWidget(ok, 7, 1)
self.show()
@ -
You might find more help in Pyqt4 but code you shown is not complete to give any advice.
Something wrong probably happens in slot called.
If it is helpAction you may try to comment lines started with a.init() and up and see what causes failure.