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:
Igor Kushnir
2021-03-08 17:44:30 +02:00
parent 5254e66da3
commit 24e42f76d2
6 changed files with 48 additions and 82 deletions

View File

@ -8,7 +8,6 @@
#include <QTimer>
#include <QLabel>
#include <QPixmap>
#include <QKeyEvent>
#include <QResizeEvent>
#include <QWheelEvent>
#include <QMouseEvent>
@ -159,9 +158,9 @@ private:
MagnifyingGlass *mglass;
bool magnifyingGlassShown;
bool restoreMagnifyingGlass;
void setMagnifyingGlassShown(bool shown);
//! Manejadores de evento:
void keyPressEvent(QKeyEvent *event) override;
void resizeEvent(QResizeEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override;
@ -198,6 +197,13 @@ signals:
void openNextComic();
void openPreviousComic();
void zoomUpdated(int);
void magnifyingGlassVisibilityChanged(bool visible);
// The following signals are emitted by users of this class and propagated to mglass.
void magnifyingGlassSizeUp();
void magnifyingGlassSizeDown();
void magnifyingGlassZoomIn();
void magnifyingGlassZoomOut();
};
#endif