Skip to content

Commit

Permalink
Fix to engine_interface::eventFilter() for Qt6
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrettin committed Feb 24, 2024
1 parent 8283d20 commit 7515129
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/stratagus/engine_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ bool engine_interface::eventFilter(QObject *source, QEvent *event)
return true;
}

this->store_input_event(std::make_unique<QMouseEvent>(*mouse_event));
this->store_input_event(std::unique_ptr<QInputEvent>(static_cast<QInputEvent *>(mouse_event->clone())));
return true;
}
case QEvent::HoverEnter:
Expand All @@ -235,13 +235,13 @@ bool engine_interface::eventFilter(QObject *source, QEvent *event)
return true;
}

this->store_input_event(std::make_unique<QHoverEvent>(*hover_event));
this->store_input_event(std::unique_ptr<QInputEvent>(static_cast<QInputEvent *>(hover_event->clone())));
return true;
}
case QEvent::KeyPress:
case QEvent::KeyRelease: {
const QKeyEvent *key_event = static_cast<QKeyEvent *>(event);
this->store_input_event(std::make_unique<QKeyEvent>(*key_event));
this->store_input_event(std::unique_ptr<QInputEvent>(static_cast<QInputEvent *>(key_event->clone())));

if (key_event->key() == Qt::Key_Tab || key_event->key() == Qt::Key_Backtab) {
return true; //consume tab events to prevent tab focus switching
Expand Down

0 comments on commit 7515129

Please sign in to comment.