Allow combo box scroll wheel when pressing Ctrl

Wheel scrolling was disabled for combo boxes in Qt Creator 9, because it
created more issues than it solved. Instead of completely disabling it,
allow wheel scrolling when simultaneously holding Ctrl.

Fixes: QTCREATORBUG-28578
Change-Id: I08bccf039b60035bf425fac95b6af6fad349f43a
Reviewed-by: Tasuku Suzuki <tasuku.suzuki@signal-slot.co.jp>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Eike Ziller
2023-01-02 14:00:02 +01:00
parent 91b5274276
commit 394caa1fee

View File

@@ -391,8 +391,10 @@ int ManhattanStyle::styleHint(StyleHint hint, const QStyleOption *option, const
ret = 0; ret = 0;
break; break;
case QStyle::SH_ComboBox_AllowWheelScrolling: case QStyle::SH_ComboBox_AllowWheelScrolling:
// Turn this off completely to prevent accidental current index change on a scroll view // Turn this on only when simultaneously pressing Ctrl, to prevent accidental current
ret = false; // index change, e.g. on a scroll view
ret = QGuiApplication::keyboardModifiers()
== (HostOsInfo::isMacHost() ? Qt::MetaModifier : Qt::ControlModifier);
break; break;
default: default:
break; break;