New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG : make qApp global before using it #3381
Conversation
Make qApp global in backend_qt5.py before using it. This silences a warning.
BUG : make qApp global before using it
I am confused by this. "qApp" is actually something that comes from PyQt5.QtCore. |
Not in this case. Look a few lines below it is initialised either as |
In addition I can't see it in QtCore In [4]: from PyQt5.QtCore import qApp
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-333c82883eb3> in <module>()
----> 1 from PyQt5.QtCore import qApp
ImportError: cannot import name 'qApp' There is a qAbs |
Sorry, I meant
On Tue, Aug 19, 2014 at 8:48 AM, Jens H Nielsen notifications@github.com
|
Or
Wrong module, sorry. |
To avoid this name confusion, we should not be using qApp as a variable name. |
@ezust, what is the right way to handle this? At the C++ level, qApp is described as a Macro; what is it in PyQt5? How is it initialized? |
The only reference I could find in PyQT docs is this http://pyqt.sourceforge.net/Docs/PyQt4/qtgui.html#qApp-var (In PyQT4 it was in qtgui) But it is not very informative |
It looks like qApp is initialized by Qt in a very similar way to how you On Tue, Aug 19, 2014 at 10:29 AM, Eric Firing notifications@github.com
|
The reason it is a macro in c++ is so it can return a QCoreApplication if |
My understanding of this was that there can only be one running For convince we store the the reference in a module-level global. |
@tacaswell, I think your understanding is correct, and the existing code is OK. I suspect that the same thing could be accomplished using the imported qApp, but it would take some investigation to figure out how to do it (e.g., how is it initialized upon import?). This might be worth sorting out, but if the present code works, then changing it is not high priority. The present organization, in which backend_qt4 imports |
Make qApp global in backend_qt5.py before using it.
This silences a warning.
I don't think this change requires a new RC.
closes #3379