NComboBox: fix clicking issue

This commit is contained in:
Ly-sec
2025-11-30 19:48:43 +01:00
parent 087c9b4ced
commit 7f88725023
2 changed files with 70 additions and 16 deletions
+35 -6
View File
@@ -112,16 +112,45 @@ Item {
ListView {
id: listView
anchors.fill: parent
// Enable clipping to keep content within bounds
anchors.rightMargin: root.verticalScrollBarActive ? root.handleWidth + 4 : 0
clip: true
// Enable flickable for smooth scrolling
boundsBehavior: Flickable.StopAtBounds
flickDeceleration: 1500
Timer {
id: scrollbarActiveTimer
interval: 150
repeat: false
}
WheelHandler {
id: wheelHandler
target: listView
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
onWheel: function(event) {
if (listView.flicking || listView.moving) {
listView.cancelFlick();
}
var delta = event.pixelDelta.y !== 0 ? event.pixelDelta.y : (event.angleDelta.y / 8);
var newContentY = listView.contentY - delta;
newContentY = Math.max(0, Math.min(newContentY, listView.contentHeight - listView.height));
listView.contentY = newContentY;
if (listView.ScrollBar.vertical) {
listView.ScrollBar.vertical.active = true;
}
scrollbarActiveTimer.restart();
event.accepted = true;
}
}
ScrollBar.vertical: ScrollBar {
parent: listView
x: listView.mirrored ? 0 : listView.width - width
parent: root // Position relative to root Item, not listView
x: listView.mirrored ? 0 : root.width - width
y: 0
height: listView.height
policy: root.verticalPolicy