Details
Description
There is a qApp macro in Qt5 which is equivalent to Q*Application.instance().
Python does not have macros. Both PyQt5 and PySide2 have an according structure in QtWidgets. In the case of PySide2, the qApp variable is first initialized to None and set later when QApplication is created.
This does not reflect the original sense of the qApp macro, because
- it only handles QApplication
- it does not handle destruction.
This "macro" should live in QtCore, but both PyQt5 and PySide2 decided to put this into QtWidgets as QtWidgets.qApp. As a compromize, I propose to let qApp appear in all three modules, so wherever you create an application, you can find this "macro" in place. In addition, it exists in the builtin module and is therefore freely accessible under the name qApp.
Attachments
Issue Links
- relates to
-
PYSIDE-1144 Embedded Python/PySide QApplication::Instance() returns QCoreApplicationWrapper instance
- Closed
-
PYSIDE-2605 runtime error when getting the style of a widget in embedded application
- Closed
-
PYSIDE-1178 Replacing the qApp "macro" by a no-surprizes qApp callable?
- Closed
For Gerrit Dashboard: PYSIDE-571 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
207351,34 | Support the qApp macro correctly, final version incl. debug | 5.6 | pyside/pyside-setup | Status: MERGED | -2 | 0 |
262739,27 | Support the qApp macro in "scriptable application" | 5.12 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
263975,5 | correct bool(qApp) on Python 2 | 5.12 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
290272,2 | Fix not so small bug in qApp | 5.14 | pyside/pyside-setup | Status: ABANDONED | +2 | 0 |
290509,11 | Turn qApp into a normal Python variable, finally | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
291705,3 | Examples: Adapt to new qApp variable | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
294010,3 | Examples: Remove qApp import | 5.14 | pyside/pyside-setup | Status: MERGED | +2 | 0 |
294055,2 | Examples: Remove qApp import | 5.14.2 | pyside/pyside-setup | Status: MERGED | +2 | 0 |