Fixed shortcuts for move actions

This commit is contained in:
Stefan Malewski 2020-11-05 22:11:44 -03:00 committed by Luis Ángel San Martín
parent 77bfd58c35
commit fccf9ab0af

View File

@ -629,7 +629,7 @@ void Viewer::keyPressEvent(QKeyEvent *event)
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y) ||
key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_RIGHT_ACTION_Y)) {
QAbstractScrollArea::keyPressEvent(event);
moveAction(key);
emit backgroundChanges();
}
@ -652,6 +652,26 @@ void Viewer::keyPressEvent(QKeyEvent *event)
QAbstractScrollArea::keyPressEvent(event);
}
void Viewer::moveAction(QKeySequence key)
{
int _key = 0;
if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_DOWN_ACTION_Y))
_key = Qt::Key_Down;
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_UP_ACTION_Y))
_key = Qt::Key_Up;
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_LEFT_ACTION_Y))
_key = Qt::Key_Left;
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(MOVE_RIGHT_ACTION_Y))
_key = Qt::Key_Right;
QKeyEvent _event = QKeyEvent(QEvent::KeyPress, _key, Qt::NoModifier);
QAbstractScrollArea::keyPressEvent(&_event);
}
static void animateScroll(QPropertyAnimation &scroller, const QScrollBar &scrollBar, int delta)
{
int deltaNotFinished = 0;