-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Move setting of AA_EnableHighDpiScaling before creating QApplication. #14566
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
Conversation
QtWidgets.QApplication.setAttribute( | ||
QtCore.Qt.AA_EnableHighDpiScaling) | ||
except AttributeError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would add a comment # QtCore.Qt.AA_EnableHighDpiScaling only available on Qt >= 5.6
to clarify why we expect an AttributeError.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.
This is required by the docs (https://doc.qt.io/qt-5/qt.html#ApplicationAttribute-enum) and Qt 5.12.4 has started emitting a warning otherwise ("Attribute Qt::AA_EnableHighDpiScaling must be set before QCoreApplication is created.")
1e4c746
to
f008360
Compare
@@ -118,6 +118,11 @@ def _create_qApp(): | |||
if display is None or not re.search(r':\d', display): | |||
raise RuntimeError('Invalid DISPLAY variable') | |||
|
|||
try: | |||
QtWidgets.QApplication.setAttribute( | |||
QtCore.Qt.AA_EnableHighDpiScaling) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was inside a if is_pyqt5()
block below; does running this still work fine on Qt4?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that'll be caught by the AttributeError too.
… before creating QApplication.
…566-on-v3.1.x Backport PR #14566 on branch v3.1.x (Move setting of AA_EnableHighDpiScaling before creating QApplication.)
We may need to put a similar change into ipython as they frequently create the QApplication instance we use. |
This is required by the docs
(https://doc.qt.io/qt-5/qt.html#ApplicationAttribute-enum)
and Qt 5.12.4 has started emitting a warning otherwise
("Attribute Qt::AA_EnableHighDpiScaling must be set before
QCoreApplication is created.")
PR Summary
PR Checklist