mirror of
https://github.com/YACReader/yacreader
synced 2025-07-14 11:04:25 -04:00
Make Magnifying glass shortcuts work with non-Latin layouts
Viewer::keyPressEvent()'s and MagnifyingGlass::keyPressEvent()'s custom matching of these shortcuts is the same as MainWindowViewer::keyPressEvent()'s before the recent commit "Reader: make 3 keyboard shortcuts work with non-Latin layouts". That commit's message details the issues with the custom code. The Magnifying glass actions are now enabled/disabled when loadedComicActions are enabled/disabled - for the same reason (see the recent "Reader: make 12 keyboard shortcuts work with non-Latin layouts" commit). In addition, Viewer::keyPressEvent() propagated the Magnifying glass shortcuts to MagnifyingGlass only when it was visible. Therefore showing/hiding Magnifying glass also enables/disables these actions. Note that Viewer::showMagnifyingGlass() shows Magnifying glass only if render->hasLoadedComic() returns true, so MainWindowViewer::setMglassActionsEnabled slot can be connected directly to Viewer::magnifyingGlassVisibilityChanged signal without checking this condition again.
This commit is contained in:
@ -280,46 +280,3 @@ bool MagnifyingGlass::shrinkHeight(int &h) const
|
||||
h -= heightStep;
|
||||
return true;
|
||||
}
|
||||
|
||||
void MagnifyingGlass::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
bool validKey = false;
|
||||
|
||||
int _key = event->key();
|
||||
Qt::KeyboardModifiers modifiers = event->modifiers();
|
||||
|
||||
if (modifiers & Qt::ShiftModifier)
|
||||
_key |= Qt::SHIFT;
|
||||
if (modifiers & Qt::ControlModifier)
|
||||
_key |= Qt::CTRL;
|
||||
if (modifiers & Qt::MetaModifier)
|
||||
_key |= Qt::META;
|
||||
if (modifiers & Qt::AltModifier)
|
||||
_key |= Qt::ALT;
|
||||
|
||||
QKeySequence key(_key);
|
||||
|
||||
if (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_UP_MGLASS_ACTION_Y)) {
|
||||
sizeUp();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(SIZE_DOWN_MGLASS_ACTION_Y)) {
|
||||
sizeDown();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_IN_MGLASS_ACTION_Y)) {
|
||||
zoomIn();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
else if (key == ShortcutsManager::getShortcutsManager().getShortcut(ZOOM_OUT_MGLASS_ACTION_Y)) {
|
||||
zoomOut();
|
||||
validKey = true;
|
||||
}
|
||||
|
||||
if (validKey) {
|
||||
event->setAccepted(true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user