浏览代码

InputComponent: clear all repeat state in cancelAutoRepeat

Also factor some minor duplicated code.
Vincent Lang 8 年之前
父节点
当前提交
55cb138bdb
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      src/input/InputComponent.cpp

+ 3 - 3
src/input/InputComponent.cpp

@@ -155,9 +155,7 @@ void InputComponent::remapInput(const QString &source, const QString &keycode, I
 
   if (keyState == InputBase::KeyUp)
   {
-    m_autoRepeatTimer->stop();
-    m_autoRepeatActions.clear();
-    m_autoRepeatCount = 0;
+    cancelAutoRepeat();
 
     if (!m_currentLongPressAction.isEmpty())
     {
@@ -281,4 +279,6 @@ void InputComponent::registerHostCommand(const QString& command, std::function<v
 void InputComponent::cancelAutoRepeat()
 {
   m_autoRepeatTimer->stop();
+  m_autoRepeatActions.clear();
+  m_autoRepeatCount = 0;
 }