Merge pull request #1988 from gamesguru/fix/settings-comboBox-no-autocapture-scroll

prevent comboBox & spinner from capturing mouse scroll unless active
This commit is contained in:
Shane Jaroch 2026-02-08 13:31:13 -05:00 committed by GitHub
parent 2ece2aee9f
commit 3a707a5ee5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 31 additions and 11 deletions

View file

@ -450,8 +450,8 @@ linting:
before_script: before_script:
- apk update && apk add make git python3 py3-pip qt6-qtdeclarative-dev - apk update && apk add make git python3 py3-pip qt6-qtdeclarative-dev
# clang18 seems to mess with the emit keyword when using the `->` operator # clang18 seems to mess with the emit keyword when using the `->` operator
- apk add clang17-extra-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main - apk add clang-extra-tools --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
- export PATH="$PATH:/usr/lib/llvm17/bin/:/root/.local/bin" - export PATH="$PATH:/usr/lib/llvm/bin/:/root/.local/bin"
- pip3 install --break-system-packages --user reuse - pip3 install --break-system-packages --user reuse
script: script:
- make lint - make lint

View file

@ -246,6 +246,7 @@ endif()
# #
# Discover Qt dependencies. # Discover Qt dependencies.
# #
find_package(Qt6 6.5 COMPONENTS Core Widgets Gui LinguistTools Svg Multimedia Qml QuickControls2 REQUIRED) find_package(Qt6 6.5 COMPONENTS Core Widgets Gui LinguistTools Svg Multimedia Qml QuickControls2 REQUIRED)
if (Qt6Qml_VERSION VERSION_GREATER_EQUAL "6.10.0") if (Qt6Qml_VERSION VERSION_GREATER_EQUAL "6.10.0")
find_package(Qt6 REQUIRED COMPONENTS GuiPrivate QmlPrivate) find_package(Qt6 REQUIRED COMPONENTS GuiPrivate QmlPrivate)
@ -298,7 +299,8 @@ if(NOT MSVC)
-fsized-deallocation \ -fsized-deallocation \
-fdiagnostics-color=always \ -fdiagnostics-color=always \
-Wunreachable-code \ -Wunreachable-code \
-Wno-attributes" -Wno-attributes \
-Wno-error=unused-parameter"
) )
if(NOT CMAKE_COMPILER_IS_GNUCXX) if(NOT CMAKE_COMPILER_IS_GNUCXX)
# -Wshadow is buggy and broken in GCC, so do not enable it. # -Wshadow is buggy and broken in GCC, so do not enable it.
@ -542,7 +544,9 @@ if(USE_BUNDLED_OLM)
Olm Olm
GIT_REPOSITORY https://gitlab.matrix.org/matrix-org/olm.git GIT_REPOSITORY https://gitlab.matrix.org/matrix-org/olm.git
GIT_TAG 3.2.16 GIT_TAG 3.2.16
PATCH_COMMAND git apply ${CMAKE_CURRENT_SOURCE_DIR}/third_party/olm-patches/0001-fix-list-const-ptr.patch PATCH_COMMAND git apply
${CMAKE_CURRENT_SOURCE_DIR}/third_party/olm-patches/0001-fix-list-const-ptr.patch
${CMAKE_CURRENT_SOURCE_DIR}/third_party/olm-patches/0002-fix-cmake-cmp0148.patch
UPDATE_DISCONNECTED 1 UPDATE_DISCONNECTED 1
) )
set(OLM_TESTS OFF CACHE INTERNAL "") set(OLM_TESTS OFF CACHE INTERNAL "")

View file

@ -304,13 +304,16 @@ ApplicationWindow {
} }
ComboBox { ComboBox {
id: notificationsCombo
Layout.fillWidth: true
model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")] model: [qsTr("Muted"), qsTr("Mentions only"), qsTr("All messages")]
currentIndex: roomSettings.notifications currentIndex: roomSettings.notifications
onActivated: (index) => { onActivated: (index) => {
roomSettings.changeNotifications(index); roomSettings.changeNotifications(index);
} }
Layout.fillWidth: true
WheelHandler{} // suppress scrolling changing values // Disable built-in wheel handling unless focused
wheelEnabled: activeFocus
} }
Label { Label {

View file

@ -100,10 +100,13 @@ Rectangle {
model: r.model.values model: r.model.values
currentIndex: r.model.value currentIndex: r.model.value
width: Math.min(implicitWidth, scroll.availableWidth - Nheko.paddingMedium) width: Math.min(implicitWidth, scroll.availableWidth - Nheko.paddingMedium)
onActivated: r.model.value = currentIndex onActivated: {
r.model.value = currentIndex
}
implicitContentWidthPolicy: ComboBox.WidestTextWhenCompleted implicitContentWidthPolicy: ComboBox.WidestTextWhenCompleted
WheelHandler{} // suppress scrolling changing values // Disable built-in wheel handling unless focused
wheelEnabled: activeFocus
} }
} }
DelegateChoice { DelegateChoice {
@ -118,7 +121,7 @@ Rectangle {
onValueChanged: model.value = value onValueChanged: model.value = value
editable: true editable: true
WheelHandler{} // suppress scrolling changing values wheelEnabled: activeFocus
} }
} }
DelegateChoice { DelegateChoice {
@ -153,7 +156,7 @@ Rectangle {
return Number.fromLocaleString(locale, text) * spinbox.div return Number.fromLocaleString(locale, text) * spinbox.div
} }
WheelHandler{} // suppress scrolling changing values wheelEnabled: activeFocus
} }
} }
DelegateChoice { DelegateChoice {
@ -272,6 +275,5 @@ Rectangle {
ToolTip.text: qsTr("Back") ToolTip.text: qsTr("Back")
onClicked: mainWindow.pop() onClicked: mainWindow.pop()
} }
} }

View file

@ -0,0 +1,11 @@
--- CMakeLists.txt.orig 2026-01-25 20:50:49.905592647 -0500
+++ CMakeLists.txt 2026-01-25 20:50:49.908925942 -0500
@@ -1,4 +1,7 @@
-cmake_minimum_required(VERSION 3.4)
+cmake_minimum_required(VERSION 3.5)
+if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.27")
+ cmake_policy(SET CMP0148 OLD)
+endif()
project(olm VERSION 3.2.16 LANGUAGES CXX C)