Fix search field losing focus when scrolling the setting list

When scrolling the setting list, it was clearing the focus in order to close the pop-ups in the setting list. If pop-ups like for the infill pattern or extruder selection settings are not closed, the pop-up part is still rendered even if the user scrolls those settings out of view, causing the pop-up to appear somewhere on top of completely unrelated interface elements. It scrolls all the way to the top of the screen, effectively.

I couldn't find a way to cause pop-ups to be clipped with the rest of the contents of the ListView. They are always rendered on top due to the nature of the pop-up. I could find a way to trigger pop-ups to close upon changing the scrolled position without changing the focus, but that method was fairly complex with a bunch of `Connection`s and an extra signal. This is by far the simplest solution.

Contributes to issue CURA-9070.
This commit is contained in:
Ghostkeeper 2022-04-21 11:16:55 +02:00
parent 1b228ecc07
commit 3f9c7c55dc
No known key found for this signature in database
GPG key ID: 68F39EA88EEED5FF

View file

@ -195,7 +195,7 @@ Item
onPositionChanged: {
// This removes focus from items when scrolling.
// This fixes comboboxes staying open and scrolling container
if (!activeFocus) {
if (!activeFocus && !filter.activeFocus) {
forceActiveFocus();
}
}