ui/MainWindow: use switch in eventFilter (#28276)

old-commit-hash: 2c44c8980c3893c01453049dd06a396e6f2358ad
This commit is contained in:
Dean Lee
2023-05-25 11:45:58 +08:00
committed by GitHub
parent 33ddd8eb44
commit cdd5958ab7
+10 -5
View File
@@ -79,11 +79,16 @@ void MainWindow::closeSettings() {
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
const static QSet<QEvent::Type> evts({QEvent::MouseButtonPress, QEvent::MouseMove,
QEvent::TouchBegin, QEvent::TouchUpdate, QEvent::TouchEnd});
if (evts.contains(event->type())) {
device.resetInteractiveTimout();
switch (event->type()) {
case QEvent::TouchBegin:
case QEvent::TouchUpdate:
case QEvent::TouchEnd:
case QEvent::MouseButtonPress:
case QEvent::MouseMove:
device.resetInteractiveTimout();
break;
default:
break;
}
return false;
}