Fix alt + mousewheel vertical being changed to horizontal for qwidgets

This commit is contained in:
rainmakerv2 2025-02-27 15:12:43 +08:00
parent 82e0e7136a
commit bac0b4bb2d

View File

@ -1016,14 +1016,23 @@ bool KBMSettings::eventFilter(QObject* obj, QEvent* event) {
}
if (wheelEvent->angleDelta().x() > 5) {
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
SetMapping("mousewheelright");
// QT changes scrolling to horizontal for all widgets with the alt modifier
if (Qt::AltModifier & QApplication::keyboardModifiers()) {
SetMapping("mousewheelup");
} else {
SetMapping("mousewheelright");
}
} else {
QMessageBox::information(this, "Cannot set mapping",
"Mousewheel cannot be mapped to stick outputs");
}
} else if (wheelEvent->angleDelta().x() < -5) {
if (std::find(AxisList.begin(), AxisList.end(), MappingButton) == AxisList.end()) {
SetMapping("mousewheelleft");
if (Qt::AltModifier & QApplication::keyboardModifiers()) {
SetMapping("mousewheeldown");
} else {
SetMapping("mousewheelleft");
}
} else {
QMessageBox::information(this, "Cannot set mapping",
"Mousewheel cannot be mapped to stick outputs");