fix: switch on mouse key

1. 过滤掉开关键的非MouseButtonPress类型的事件的处理
This commit is contained in:
rankun 2020-01-19 22:23:32 +08:00
commit 1aa5989585

View file

@ -49,10 +49,10 @@ InputConvertGame::~InputConvertGame()
void InputConvertGame::mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize) void InputConvertGame::mouseEvent(const QMouseEvent *from, const QSize &frameSize, const QSize &showSize)
{ {
// 处理开关按键 // 处理开关按键
if (m_keyMap.isSwitchOnKeyboard() == false && if (m_keyMap.isSwitchOnKeyboard() == false && m_keyMap.getSwitchKey() == from->button()) {
from->type() == QEvent::MouseButtonPress && if (from->type() != QEvent::MouseButtonPress) {
m_keyMap.getSwitchKey() == from->button()) return;
{ }
if (!switchGameMap()) { if (!switchGameMap()) {
m_needSwitchGameAgain = false; m_needSwitchGameAgain = false;
} }
@ -89,10 +89,11 @@ void InputConvertGame::keyEvent(const QKeyEvent *from, const QSize& frameSize, c
{ {
// 处理开关按键 // 处理开关按键
if (m_keyMap.isSwitchOnKeyboard() && m_keyMap.getSwitchKey() == from->key()) { if (m_keyMap.isSwitchOnKeyboard() && m_keyMap.getSwitchKey() == from->key()) {
if (QEvent::KeyPress == from->type()) { if (QEvent::KeyPress != from->type()) {
if (!switchGameMap()) { return;
m_needSwitchGameAgain = false; }
} if (!switchGameMap()) {
m_needSwitchGameAgain = false;
} }
return; return;
} }