Merge pull request #176 from smalewski/develop

Fixes move action shortcuts not working
This commit is contained in:
Luis Ángel San Martín
2021-01-17 11:45:32 +01:00
committed by GitHub
3 changed files with 24 additions and 1 deletions

View File

@ -9,6 +9,7 @@ Version counting is based on semantic versioning (Major.Feature.Patch)
## WIP
### YACReader
* Add support for full manga mode.
* Fix UP,DOWN,LEFT,RIGHT shortcuts for moving a zoomed in page around.
### YACReaderLibrary
* New search engine.
* New `manga` field added to comics and folders to tag content as manga, any content added to a manga folder will become manga automatically.

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(const 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;

View File

@ -164,6 +164,8 @@ private:
void wheelEvent(QWheelEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
void moveAction(const QKeySequence &key);
//!ZigzagScroll
enum scrollDirection { UP,
DOWN,