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 focus policy for mainwindow to prevent keeping focus on the axis labels (and other QLineEdit based widgets) when clicking outside the widget #5812

Merged
merged 1 commit into from Jun 22, 2023

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented May 8, 2023

Fixes/Closes

Closes #1571

Description

This changes the focus policy for the _QtMainWindow class to be set to Qt.FocusPolicy.StrongFocus. With this change, the axis label line edit widget is able to loss focus when clicking outside it (as well as other QLineEdit based widgets):

An example is loaded and then interactions with the dim slider widget are done. The focus is set to axis and dim label widgets and unset by clicking outside them

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

…labels (and other QLineEdit based widgets) when clicking outside the line edit widget area
@dalthviz dalthviz marked this pull request as ready for review May 8, 2023 16:38
@github-actions github-actions bot added the qt Relates to qt label May 8, 2023
@dalthviz dalthviz added the bugfix PR with bugfix label May 8, 2023
@dalthviz dalthviz changed the title Set focus policy for mainwindow to prevent keeping focus on the axis labels (and other QLineEdit based widgets) when clicking outside the line edit widget area Set focus policy for mainwindow to prevent keeping focus on the axis labels (and other QLineEdit based widgets) when clicking outside the widget May 8, 2023
@codecov
Copy link

codecov bot commented May 8, 2023

Codecov Report

Merging #5812 (1ca14aa) into main (19867df) will increase coverage by 0.05%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #5812      +/-   ##
==========================================
+ Coverage   89.83%   89.88%   +0.05%     
==========================================
  Files         614      614              
  Lines       52210    52211       +1     
==========================================
+ Hits        46901    46929      +28     
+ Misses       5309     5282      -27     
Impacted Files Coverage Δ
napari/_qt/qt_main_window.py 74.21% <100.00%> (+0.04%) ⬆️

... and 7 files with indirect coverage changes

@jni jni merged commit dfdd5fb into napari:main Jun 22, 2023
35 of 36 checks passed
@Czaki Czaki mentioned this pull request Jun 23, 2023
@Czaki Czaki added this to the 0.4.18 milestone Jun 23, 2023
Czaki pushed a commit that referenced this pull request Jun 23, 2023
…labels (and other `QLineEdit` based widgets) when clicking outside the widget (#5812)

# Fixes/Closes

Closes #1571 

# Description

This changes the focus policy for the `_QtMainWindow` class to be set to
`Qt.FocusPolicy.StrongFocus`. With this change, the axis label line edit
widget is able to loss focus when clicking outside it (as well as other
`QLineEdit` based widgets):

![An example is loaded and then interactions with the dim slider widget
are done. The focus is set to axis and dim label widgets and unset by
clicking outside
them](https://user-images.githubusercontent.com/16781833/231850662-73d9c265-725d-44ef-8b6b-3d3f2c97f292.gif)
melissawm pushed a commit to melissawm/napari that referenced this pull request Jul 3, 2023
…labels (and other `QLineEdit` based widgets) when clicking outside the widget (napari#5812)

# Fixes/Closes

Closes napari#1571 

# Description

This changes the focus policy for the `_QtMainWindow` class to be set to
`Qt.FocusPolicy.StrongFocus`. With this change, the axis label line edit
widget is able to loss focus when clicking outside it (as well as other
`QLineEdit` based widgets):

![An example is loaded and then interactions with the dim slider widget
are done. The focus is set to axis and dim label widgets and unset by
clicking outside
them](https://user-images.githubusercontent.com/16781833/231850662-73d9c265-725d-44ef-8b6b-3d3f2c97f292.gif)
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.

Defocus from axis label field on slider
4 participants