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:
how to hide the popup on click.
preventing flickers to the suggestions when typing as seen here.
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.
Follow up from #1189 and Point 4 of comment
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 aQt::Tool
window withsetWindowFlags()
, which makes the window non-modal allowing clicks to fall through. The problem comes with:Difficulty comes from the focus relationship between
SearchBarLineEdit
andQCompleter::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.