mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 18:50:00 +02:00
Merge pull request #3671 from ctrlaltdavid/20107
CR for Job #20107 - Keys p and h and some control keys wont override
This commit is contained in:
commit
b506a99200
3 changed files with 17 additions and 4 deletions
|
@ -414,6 +414,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer &startup_time) :
|
||||||
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
MIDIManager& midiManagerInstance = MIDIManager::getInstance();
|
||||||
midiManagerInstance.openDefaultPort();
|
midiManagerInstance.openDefaultPort();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
this->installEventFilter(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Application::~Application() {
|
Application::~Application() {
|
||||||
|
@ -836,6 +838,19 @@ bool Application::event(QEvent* event) {
|
||||||
return QApplication::event(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) {
|
void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
|
|
||||||
_keysPressed.insert(event->key());
|
_keysPressed.insert(event->key());
|
||||||
|
|
|
@ -172,6 +172,7 @@ public:
|
||||||
void dropEvent(QDropEvent *event);
|
void dropEvent(QDropEvent *event);
|
||||||
|
|
||||||
bool event(QEvent* event);
|
bool event(QEvent* event);
|
||||||
|
bool eventFilter(QObject* object, QEvent* event);
|
||||||
|
|
||||||
void makeVoxel(glm::vec3 position,
|
void makeVoxel(glm::vec3 position,
|
||||||
float scale,
|
float scale,
|
||||||
|
|
|
@ -213,10 +213,7 @@ bool ControllerScriptingInterface::isKeyCaptured(QKeyEvent* event) const {
|
||||||
|
|
||||||
bool ControllerScriptingInterface::isKeyCaptured(const KeyEvent& event) const {
|
bool ControllerScriptingInterface::isKeyCaptured(const KeyEvent& event) const {
|
||||||
// if we've captured some combination of this key it will be in the map
|
// if we've captured some combination of this key it will be in the map
|
||||||
if (_capturedKeys.contains(event.key, event)) {
|
return _capturedKeys.contains(event.key, event);
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ControllerScriptingInterface::captureKeyEvents(const KeyEvent& event) {
|
void ControllerScriptingInterface::captureKeyEvents(const KeyEvent& event) {
|
||||||
|
|
Loading…
Reference in a new issue