mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 04:03:59 +02:00
Prevent keys captured by script from being used as menu shortcuts
This commit is contained in:
parent
2dff75dac1
commit
c6463abfb8
2 changed files with 16 additions and 0 deletions
|
@ -414,6 +414,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
|||
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
||||
midiManagerInstance.openDefaultPort();
|
||||
#endif
|
||||
|
||||
this->installEventFilter(this);
|
||||
}
|
||||
|
||||
Application::~Application() {
|
||||
|
@ -836,6 +838,19 @@ bool Application::event(QEvent* event) {
|
|||
return QApplication::event(event);
|
||||
}
|
||||
|
||||
bool Application::eventFilter(QObject* object, QEvent* event) {
|
||||
|
||||
if (event->type() == QEvent::ShortcutOverride) {
|
||||
// Filter out captured keys before they're used for shortcut actions.
|
||||
if (_controllerScriptingInterface.isKeyCaptured(static_cast<QKeyEvent*>(event))) {
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void Application::keyPressEvent(QKeyEvent* event) {
|
||||
|
||||
_keysPressed.insert(event->key());
|
||||
|
|
|
@ -172,6 +172,7 @@ public:
|
|||
void dropEvent(QDropEvent *event);
|
||||
|
||||
bool event(QEvent* event);
|
||||
bool eventFilter(QObject* object, QEvent* event);
|
||||
|
||||
void makeVoxel(glm::vec3 position,
|
||||
float scale,
|
||||
|
|
Loading…
Reference in a new issue