Skip to content
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

Set high DPI attributes when using PySide2 #5968

Merged
merged 1 commit into from Jun 21, 2023

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Jun 19, 2023

Fixes/Closes

Bugfix part of PR #5607

Description

Fixes issues with high resolution screens when using PySide2 as Qt binding since the logic to set High DPI attributes was only covering PyQt5.

As a note, for Qt6 bindings these attributes are deprecated since they are applied by default and there is no way to deactivated them. In the other hand, there is still a needed for those attributes when using Qt5 bindings since there they are deactivated by default.

References

See https://doc.qt.io/qtforpython-6/gettingstarted/porting_from2.html#class-function-deprecations

Type of change

  • Bug-fix (non-breaking change which fixes an issue)

How has this been tested?

  • all tests pass with my change
  • I check if my changes works with both PySide and PyQt backends
    as there are small differences between the two Qt bindings.

Final checklist:

  • My PR is the minimum possible work for the desired functionality
  • I have commented my code, particularly in hard-to-understand areas

Co-authored-by: Lukasz Migas <lukas.migas@yahoo.com>
@dalthviz dalthviz added qt Relates to qt bugfix PR with bugfix labels Jun 19, 2023
@dalthviz dalthviz self-assigned this Jun 19, 2023
@dalthviz dalthviz mentioned this pull request Jun 19, 2023
7 tasks
@dalthviz dalthviz added this to the 0.4.18 milestone Jun 19, 2023
@codecov
Copy link

codecov bot commented Jun 19, 2023

Codecov Report

Merging #5968 (3861190) into main (efa55a5) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #5968   +/-   ##
=======================================
  Coverage   90.19%   90.20%           
=======================================
  Files         615      615           
  Lines       52039    52039           
=======================================
+ Hits        46939    46941    +2     
+ Misses       5100     5098    -2     
Impacted Files Coverage Δ
napari/_qt/qt_event_loop.py 80.95% <100.00%> (ø)

... and 1 file with indirect coverage changes

@dalthviz dalthviz marked this pull request as ready for review June 19, 2023 15:28
Copy link
Member

@psobolewskiPhD psobolewskiPhD left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good and works on my end, but would be nice for a linux & windows user to double check.

@Czaki Czaki mentioned this pull request Jun 19, 2023
@Czaki Czaki added the ready to merge Last chance for comments! Will be merged in ~24h label Jun 21, 2023
@jni jni merged commit 7f3e51c into napari:main Jun 21, 2023
42 checks passed
@psobolewskiPhD psobolewskiPhD removed the ready to merge Last chance for comments! Will be merged in ~24h label Jun 22, 2023
Czaki pushed a commit that referenced this pull request Jun 22, 2023
# Fixes/Closes

Bugfix part of PR #5607

# Description

Fixes issues with high resolution screens when using PySide2 as Qt
binding since the logic to set High DPI attributes was only covering
PyQt5.

As a note, for Qt6 bindings these attributes are deprecated since they
are applied by default and there is no way to deactivated them. In the
other hand, there is still a needed for those attributes when using Qt5
bindings since there they are deactivated by default.

# References

See
https://doc.qt.io/qtforpython-6/gettingstarted/porting_from2.html#class-function-deprecations

Co-authored-by: Lukasz Migas <lukas.migas@yahoo.com>
melissawm pushed a commit to melissawm/napari that referenced this pull request Jul 3, 2023
# Fixes/Closes

Bugfix part of PR napari#5607

# Description

Fixes issues with high resolution screens when using PySide2 as Qt
binding since the logic to set High DPI attributes was only covering
PyQt5.

As a note, for Qt6 bindings these attributes are deprecated since they
are applied by default and there is no way to deactivated them. In the
other hand, there is still a needed for those attributes when using Qt5
bindings since there they are deactivated by default.

# References

See
https://doc.qt.io/qtforpython-6/gettingstarted/porting_from2.html#class-function-deprecations

Co-authored-by: Lukasz Migas <lukas.migas@yahoo.com>
GenevieveBuckley pushed a commit that referenced this pull request Aug 1, 2023
# Fixes/Closes

Closes #1417 

# Description

This PR adds a new `font_size` attribute to the theme which is injected
sporadically throughout the stylesheets.

A fix for an issue on Windows (perhaps other OSs too?) that have
multiple high-res screens connected (and use PySide2 as the backend) was
done initially here but was moved to its own PR. See PR #5968

Before:
- text in the app is way too small to use

![image](https://user-images.githubusercontent.com/25161821/223431336-1358824b-ef92-4a4c-998b-6438535533e4.png)

After:
- text is of expected size and can be changed by changing the
`.font_size` attribute of the current theme

![image](https://user-images.githubusercontent.com/25161821/223431591-7c6cedf2-3e1d-48dd-bb69-f433e0f1b4f1.png)

## Type of change
<!-- Please delete options that are not relevant. -->
- [x] New feature (non-breaking change which adds functionality)

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [x] all tests pass with my change
- [x] I check if my changes works with both PySide and PyQt backends
      as there are small differences between the two Qt bindings.  

Co-authored-by: Daniel Althviz Moré <d.althviz10@uniandes.edu.co>
Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
dstansby pushed a commit to dstansby/napari that referenced this pull request Aug 2, 2023
# Fixes/Closes

Closes napari#1417 

# Description

This PR adds a new `font_size` attribute to the theme which is injected
sporadically throughout the stylesheets.

A fix for an issue on Windows (perhaps other OSs too?) that have
multiple high-res screens connected (and use PySide2 as the backend) was
done initially here but was moved to its own PR. See PR napari#5968

Before:
- text in the app is way too small to use

![image](https://user-images.githubusercontent.com/25161821/223431336-1358824b-ef92-4a4c-998b-6438535533e4.png)

After:
- text is of expected size and can be changed by changing the
`.font_size` attribute of the current theme

![image](https://user-images.githubusercontent.com/25161821/223431591-7c6cedf2-3e1d-48dd-bb69-f433e0f1b4f1.png)

## Type of change
<!-- Please delete options that are not relevant. -->
- [x] New feature (non-breaking change which adds functionality)

# How has this been tested?
<!-- Please describe the tests that you ran to verify your changes. -->
- [x] all tests pass with my change
- [x] I check if my changes works with both PySide and PyQt backends
      as there are small differences between the two Qt bindings.  

Co-authored-by: Daniel Althviz Moré <d.althviz10@uniandes.edu.co>
Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix PR with bugfix qt Relates to qt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants