Преглед изворни кода

Avoid duplicate QMetaObject::invokeMethod() call

Both calls actually go to the same method, with the no-arguments one
just using a QGenericArgument(0) value as default argument.
Vincent Lang пре 9 година
родитељ
комит
b20376eaa8
1 измењених фајлова са 4 додато и 8 уклоњено
  1. 4 8
      src/input/InputComponent.cpp

+ 4 - 8
src/input/InputComponent.cpp

@@ -105,15 +105,11 @@ void InputComponent::remapInput(const QString &source, const QString &keycode, f
         if (recvSlot)
         {
           QLOG_DEBUG() << "Invoking slot" << qPrintable(recvSlot->slot.data());
+          QGenericArgument arg0 = QGenericArgument();
           if (recvSlot->hasArguments)
-          {
-            QMetaObject::invokeMethod(recvSlot->receiver, recvSlot->slot.data(),
-                                      Qt::AutoConnection, Q_ARG(const QString&, hostArguments));
-          }
-          else
-          {
-            QMetaObject::invokeMethod(recvSlot->receiver, recvSlot->slot.data(), Qt::AutoConnection);
-          }
+            arg0 = Q_ARG(const QString&, hostArguments);
+          QMetaObject::invokeMethod(recvSlot->receiver, recvSlot->slot.data(),
+                                    Qt::AutoConnection, arg0);
         }
       }
       else