[ui] [fix]: The focus on text components is now released on outside click #2740
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Bug:
Clicking outside of a text component (a search filter in the example below), didn't release the focus.

Now the focus is stolen by the main.MouseArea component
Related PR
This is an other approach of the PR provided by @waaake: #2666
It avoid creating
MouseArea
on existing and future components.Implementation Details
It uses the eventFilter to only catch the mousePress events and clear focus each time an item have a focus at this step.
/!\ Having a python condition on each event can be time consuming.
It uses the
EventFilter
and can have some performance cost, but because it directly filtered event by type() (not isinstance) , it should be imperceptible.