Allow disabling combobox value changing with scrolling
When a ComboBox is set inside ScrollView it is easy to make the mistake of editing the ComboBox by hovering over the ComboBox and scrolling on the ComboBox instead of an empty part of the window. When ComboBox.width: 100%; this situation is inevitable.
I tried getting around this with a wrapper TouchArea catching scroll events, but looks like the TouchArea would need to be inside the ComboBox for this to work.
import { AboutSlint, Button, VerticalBox, ScrollView, ComboBox } from "std-widgets.slint";
export component Demo {
height: 300px;
ScrollView
{
VerticalLayout {
padding: 50px;
for i in 5 : TouchArea {
height: 100px;
ComboBox {
height: 100%;
width: 100%;
model: ["setting-a", "setting-b", "setting-c"];
}
scroll-event(ev) => {
EventResult.accept // since this controls whether parent element gets the event, this does nothing for the child combobox
}
}
Text {
text: "----";
}
for i in 5 : ComboBox {
height: 100px;
model: ["setting-a", "setting-b", "setting-c"];
}
}
}
}
Thanks for the bug report. We should do the same as what the platform natively does. I tried Qt and the wheel does change the combobox even within scroll area. On windows, it seems that the wheel only change the content of the combobox if it has focus.
I have disabled it in Qt Creator - https://codereview.qt-project.org/c/qt-creator/qt-creator/+/429103 Qt allows users to disable it thorugh style QStyle::SH_ComboBox_AllowWheelScrolling. I'm wondering if I can disable it through a property or an environment variable.
This is causing a particular horrible issue with the Slint live-preview. You scroll the panel of visual properties and as the mouse moves over the combo boxes for unit types they get change from e.g. px to rem and lots of code is altered. Windows, Mac and I believe even linux don't have this by default regardless of if a combo box is in a scrollview or anywhere.
One fix that could be done is to only allow this to work if the combobox has focus.