X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/c161b895ffd8d62371ec288cf4105386350a8a3c..dc3beae3ab2c55cd3501e17f93b51e93e876a177:/src/dolphincontextmenu.cpp diff --git a/src/dolphincontextmenu.cpp b/src/dolphincontextmenu.cpp index eb3f641e5..2b216ce03 100644 --- a/src/dolphincontextmenu.cpp +++ b/src/dolphincontextmenu.cpp @@ -63,7 +63,7 @@ DolphinContextMenu::DolphinContextMenu(DolphinMainWindow* parent, const DolphinView* view = m_mainWindow->activeViewContainer()->view(); m_selectedItems = view->selectedItems(); - installEventFilter(this); + QApplication::instance()->installEventFilter(this); } DolphinContextMenu::~DolphinContextMenu() @@ -112,28 +112,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()