X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/7b112c7b274efaa56fc08258b1936b251dd508a0..32ebe96eca5590672ba294fa8a316eecf4ea03ea:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index e2a41e907..ef74ec7f8 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -64,7 +63,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, const DolphinView* view = m_mainWindow->activeViewContainer()->view(); m_selectedItems = view->selectedItems(); - installEventFilter(this); + QApplication::instance()->installEventFilter(this); static_cast(m_mainWindow->actionCollection()-> action(QStringLiteral("hamburger_menu")))->addToMenu(this); @@ -116,28 +115,23 @@ DolphinContextMenu::Command DolphinContextMenu::open() return m_command; } -void DolphinContextMenu::childEvent(QChildEvent* event) +bool DolphinContextMenu::eventFilter(QObject* object, QEvent* event) { - if(event->added()) { - event->child()->installEventFilter(this); - } - QMenu::childEvent(event); -} + Q_UNUSED(object) -bool DolphinContextMenu::eventFilter(QObject* dest, QEvent* event) -{ if(event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease) { QKeyEvent* keyEvent = static_cast(event); - if(m_removeAction && keyEvent->key() == Qt::Key_Shift) { - if(event->type() == QEvent::KeyPress) { + + if (m_removeAction && keyEvent->key() == Qt::Key_Shift) { + if (event->type() == QEvent::KeyPress) { m_removeAction->update(DolphinRemoveAction::ShiftState::Pressed); } else { m_removeAction->update(DolphinRemoveAction::ShiftState::Released); } - return true; } } - return QMenu::eventFilter(dest, event); + + return false; } void DolphinContextMenu::openTrashContextMenu()