8000 Move setting of AA_EnableHighDpiScaling before creating QApplication. by anntzer · Pull Request #14566 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 1 commit into from
Jun 18, 2019

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Jun 18, 2019

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

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.1.1 milestone Jun 18, 2019
QtWidgets.QApplication.setAttribute(
QtCore.Qt.AA_EnableHighDpiScaling)
except AttributeError:
pass
Copy link
Member

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.

Copy link
Contributor Author

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.")
@anntzer anntzer force-pushed the enablehighdpiscaling branch from 1e4c746 to f008360 Compare June 18, 2019 12:13
@@ -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)
Copy link
Member

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?

Copy link
Contributor Author

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.

@dstansby dstansby merged commit 90e25ec into matplotlib:master Jun 18, 2019
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Jun 18, 2019
@anntzer anntzer deleted the enablehighdpiscaling branch June 18, 2019 15:17
timhoffm added a commit that referenced this pull request Jun 18, 2019
…566-on-v3.1.x

Backport PR #14566 on branch v3.1.x (Move setting of AA_EnableHighDpiScaling before creating QApplication.)
@tacaswell
Copy link
Member

We may need to put a similar change into ipython as they frequently create the QApplication instance we use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0