OSDN Git Service

use only one case switch in DBusMenu::eventFilter()
authorIvailo Monev <xakepa10@laimg.moc>
Sun, 26 Jan 2020 15:30:45 +0000 (15:30 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Sun, 26 Jan 2020 15:30:45 +0000 (15:30 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/dbusmenu_p.cpp

index 5a960b1..40fb828 100644 (file)
@@ -45,25 +45,15 @@ DBusMenu::~DBusMenu()
 
 bool DBusMenu::eventFilter(QObject *, QEvent *event)
 {
-    QActionEvent *actionEvent = 0;
     switch (event->type()) {
     case QEvent::ActionAdded:
-    case QEvent::ActionChanged:
-    case QEvent::ActionRemoved:
-        actionEvent = static_cast<QActionEvent *>(event);
-        break;
-    default:
-        return false;
-    }
-    switch (event->type()) {
-    case QEvent::ActionAdded:
-        addAction(actionEvent->action());
+        addAction(static_cast<QActionEvent *>(event)->action());
         break;
     case QEvent::ActionChanged:
-        updateAction(actionEvent->action());
+        updateAction(static_cast<QActionEvent *>(event)->action());
         break;
     case QEvent::ActionRemoved:
-        removeAction(actionEvent->action());
+        removeAction(static_cast<QActionEvent *>(event)->action());
         break;
     default:
         break;