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

Hide the menubar when menus lose focus (if toggled off) #11355

Merged
merged 1 commit into from
Oct 26, 2024

Conversation

droidmonkey
Copy link
Member

Testing strategy

Tested manually

Type of change

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

Copy link

codecov bot commented Oct 12, 2024

Codecov Report

Attention: Patch coverage is 39.28571% with 17 lines in your changes missing coverage. Please review.

Project coverage is 63.79%. Comparing base (34fe413) to head (00cea92).
Report is 10 commits behind head on develop.

Files with missing lines Patch % Lines
src/gui/MainWindow.cpp 39.29% 17 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #11355      +/-   ##
===========================================
- Coverage    63.80%   63.79%   -0.02%     
===========================================
  Files          362      362              
  Lines        38056    38072      +16     
===========================================
+ Hits         24281    24285       +4     
- Misses       13775    13787      +12     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link
Member

@varjolintu varjolintu left a comment

Choose a reason for hiding this comment

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

This doesn't work properly. If you follow these steps, you cannot get the menubar back until you've changed the option via Application Settings:

  1. Disable the Show Menubar option from menu. Confirm that it works properly.
  2. Enable the Show Menubar option from menu.
  3. Menu bar goes hidden again. You cannot get it back even when pressing Alt. Is the timer still running? Or the options is not actually checked?
  4. Go to Application Settings and change the value of Show Menubar. Everything works again.

@droidmonkey
Copy link
Member Author

Oops, forgot to guard the timer with the config setting

@droidmonkey
Copy link
Member Author

@varjolintu fixed

@droidmonkey
Copy link
Member Author

Cleaned up the code logic a little bit and reduced the timeout to 250ms. 1 second resulted in weird delays.

@xboxones1
Copy link
Contributor

It works well, but I don't know how critical it is, hiding with Alt button sometimes works incorrectly. Instead of hiding the menu, the first menu item is opened.
keepassxc

@varjolintu
Copy link
Member

Dunno if it's worth saving the last menu opened?

@droidmonkey
Copy link
Member Author

Pressing ALT in the situation shown in the video should hide the menu bar, will have to look into that.

@droidmonkey
Copy link
Member Author

It works well, but I don't know how critical it is, hiding with Alt button sometimes works incorrectly. Instead of hiding the menu, the first menu item is opened.

Fixed it with a cooldown timer that ignores the ALT key for 250ms. This is because on Windows pressing ALT de-selects the active menu which causes the timer to hide the toolbar and then releasing ALT causes the toolbar to re-appear. So ignoring that key release ensures the toolbar stays hidden.

* Fixes #10768
* Also fix menubar toggling not working if Qt version is less than 5.15
@droidmonkey droidmonkey merged commit 5d24495 into develop Oct 26, 2024
11 checks passed
@droidmonkey droidmonkey deleted the fix/menubar-hide branch October 26, 2024 15:06
@phoerious phoerious added pr: bugfix Pull request that fixes a bug and removed bug labels Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: bugfix Pull request that fixes a bug user interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Menubar is not hidden automatically when there is no focus
4 participants