keyPressEvent isn't called simultaneously.
-
I'm developping a RPG game.
When I push the right-key and push the up-key simultaneously, event loop stops.
Why?
bool MapScene::event(QEvent *event)
{
if (event->type() == QEvent::KeyPress)
{
qDebug() << "event";
}return QGraphicsScene::event(event);
}
I tried at the upper event, but the result was the same.
1.When I move a character to the right direction, naturally I push the right-key.
2.When I change the direction, for example, I push the down-key suddenly.
3.The event is not called.To call the event, I must release completely the key button once, and then push another button.
But I dislike such a way because it is not comfortable.
Please tell me how to solve this problem. -
The most likely answer is: buy a better keyboard! You might be expecting key jamming or ghosting (https://en.wikipedia.org/wiki/Key_rollover). There are online checks for key rollover.