-
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathkeyeventhandler.cpp
More file actions
43 lines (40 loc) · 1.15 KB
/
keyeventhandler.cpp
File metadata and controls
43 lines (40 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/** @file keyeventhandler.cpp
* Soubor s tridou KeyEventHandler dedici ze tridy QObject,
* slouzi pro rozpoznani klavesovych zkratek
*/
#include "keyeventhandler.h"
KeyEventHandler::KeyEventHandler(QObject* parent)
: QObject(parent)
{
}
void KeyEventHandler::processKeyEvent(QKeyEvent* event)
{
if (event->key() == int('A') && (event->modifiers() & Qt::ControlModifier)) {
emit selectImage();
} else if (event->key() == Qt::Key_Delete) {
emit deleteSelected();
} else if (event->key() == Qt::Key_Escape) {
emit escapePressed();
} else if (!(event->modifiers() & Qt::ControlModifier)) {
switch (event->key()) {
case Qt::Key_Left:
emit selectAdjacent(-1);
event->accept();
return;
case Qt::Key_Right:
emit selectAdjacent(1);
event->accept();
return;
case Qt::Key_Up:
emit selectAdjacentRow(-1);
event->accept();
return;
case Qt::Key_Down:
emit selectAdjacentRow(1);
event->accept();
return;
default:
break;
}
}
}