[PySide] PySide application crashes when getting closed, related to QAction menu item
Stefan Champailler
schampailler at skynet.be
Tue Feb 25 08:49:28 CET 2014
not sure but you may have an onwership issue on fooMenu which gets
destroyed when you leave __init__
Solution : make fooMenu persistent, i.e. use an attribute in MainWindow,
self.fooMenu
stF
On 02/24/2014 05:39 PM, Manuel Koch wrote:
> Hi
>
> I have a strange problem related to menu actions in my PySide application:
> PySide 1.2.1, Python 2.7 32bit, Windows 7
>
> My main window uses QAction to setup menu structure.
> One of the menu items seems to cause a crash when the application is closed.
> Following small snippet seems to trigger app to crash immediately after
> hitting the close button of main window !?
>
> I'm I doing something wrong when connecting signals/slots related to
> QAction ?
>
> The code:
>
> class MainWindow(QMainWindow):
>
> def __init__(self,parent=None):
> super(MainWindow,self).__init__(parent)
> .....
> menubar = self.menuBar()
> fooMenu = menubar.addMenu("&Foo")
> # commenting out the following two lines avoids my app to crash
> self._barAct = QAction("Bar", self, checkable=True, statusTip="Do
> bar", triggered=self._onBar)
> fooMenu.addAction(self._barAct)
>
> def _onBar(self):
> "Handle toggling of bar checkbox"
> print "_onBar"
>
>
>
> _______________________________________________
> PySide mailing list
> PySide at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/pyside
--
Timeo Danaos et dona ferentes
Twitter @Arakowa1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/pyside/attachments/20140225/fc8aadf2/attachment.html>
More information about the PySide
mailing list