Ah, of course, much tidier. I will do that, thanks Sean!
On 14/07/14 2:17 AM, Sean Fisk wrote:
Hi Frank,
I would go for a different architecture if possible. Have you
considered giving TestWidget a signal which gets connected to
app.quit() in the standalone application? In the host application,
just don't connect it to anything. You could name the signal
'quit_requested' or something like that, but adapt it to your
scenario. I'm not sure if this is possible in your situation; just a
suggestion.
- Sean
--
Sean Fisk
On Sun, Jul 13, 2014 at 9:19 AM, Frank Rueter | OHUfx <fr...@ohufx.com
<mailto:fr...@ohufx.com>> wrote:
Hi,
I have a QWidget that uses
self.setWindowFlags(QtCore.Qt.Popup)
This causes the widget to not quit the QApplication when it closes
even
though it's the main widget.
I can put something like QtGui.QApplication.instance().quit() into the
appropriate event to ensure the application closes properly, but
most of
the time this widget will be run from inside a host application,
not as
a standalone app, so closing the application instance would have fatal
consequences for the user.
What would be the best way to determine whether the widget is run as a
standalone, and I can quite the application safely, or if it's run
from
inside a host app?
In my current scenario I could check
QtGui.QApplication.applicationFilePath() for the host applications
that
this is mostly going to be run from, but if somebody else imports my
code into an app I didn't cater for, my QWidget will quit that
when the
widget closes, until I include the particular host in my code logic.
Here is a simple example that always manually quits the application
(when I need ti be clever and not quit if it's run from inside a
host):
http://pastebin.com/48y7nqc2
What's the best way to go about this?
Cheers,
frank
_______________________________________________
PySide mailing list
PySide@qt-project.org <mailto:PySide@qt-project.org>
http://lists.qt-project.org/mailman/listinfo/pyside
_______________________________________________
PySide mailing list
PySide@qt-project.org
http://lists.qt-project.org/mailman/listinfo/pyside