fix: switch on mouse key

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

View file

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