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

Clicking outside of Search Suggestion List Should Fall through #1200

Open
ShaopengLin opened this issue Sep 9, 2024 · 1 comment · May be fixed by #1341
Open

Clicking outside of Search Suggestion List Should Fall through #1200

ShaopengLin opened this issue Sep 9, 2024 · 1 comment · May be fixed by #1341
Assignees
Milestone

Comments

@ShaopengLin
Copy link
Collaborator

ShaopengLin commented Sep 9, 2024

Follow up from #1189 and Point 4 of comment

Description:
Currently, If suggestions are displayed, we need to click twice on the suggestions settings to display the overlay. Only one click should be necessary.

Current behavior:
https://github.com/user-attachments/assets/93f24799-81bc-456d-8ed9-78c61f11efcd

Expected click through behavior
https://github.com/user-attachments/assets/3fad8e56-ab18-4902-969d-401ed841c0d0

Potential issues and solution discussion:

Qt's popup windows do not provide this fall-through behavior and we will need to implement our own.

One solution is to make the QCompleter::popup() as a Qt::Tool window with setWindowFlags(), which makes the window non-modal allowing clicks to fall through. The problem comes with:

  1. how to hide the popup on click.
  2. preventing flickers to the suggestions when typing as seen here.
  3. Keep all other suggestion list behavior the same.

Difficulty comes from the focus relationship between SearchBarLineEdit and QCompleter::popup(). QCompleter::popup() proxies its focus to SearchBarLineEdit and our completion logic relies on focuses. Here is what I have tried:

1. Disconnect the proxy and handle each separately. This has deemed difficult as, popup needs focus to allow user keyboard navigations, and it will take focus away from the line edit. In addition, if we hide popup when it focuses out, it will flicker when user starts typing as it constantly races for focus with the line edit.

2. Keep the proxy and go for eventFilter. It is ad-hoc and would only work to filter out FocusOut events. Global click events are not reliable for this scenario since multiple clicks can happen at the same time for one click. Also, when users clicks minimize and maximize, the suggestions does not go away as the line edit doesn't lose focus.

There might be a lot more problems than what I described here when we switch to Qt::Tool window. I have not been able to find a solution, so maybe someone more experienced has more knowledge on how to make this work.

@kelson42 kelson42 added bug enhancement UI User Interface labels Sep 9, 2024
@kelson42 kelson42 added this to the 2.5.0 milestone Sep 9, 2024
@i-am-space
Copy link

@kelson42 , I have submitted a pull request, kindly review.

@kelson42 kelson42 linked a pull request Feb 11, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants