MythTV  master
mythmainwindowprivate.cpp
Go to the documentation of this file.
1 // Qt
2 #include <QKeyEvent>
3 
4 // MythTV
6 
7 // Make keynum in QKeyEvent be equivalent to what's in QKeySequence
9 {
10  int keynum = Event->key();
11 
12  if ((keynum != Qt::Key_Shift ) && (keynum !=Qt::Key_Control ) &&
13  (keynum != Qt::Key_Meta ) && (keynum !=Qt::Key_Alt ) &&
14  (keynum != Qt::Key_Super_L) && (keynum !=Qt::Key_Super_R ) &&
15  (keynum != Qt::Key_Hyper_L) && (keynum !=Qt::Key_Hyper_R ) &&
16  (keynum != Qt::Key_AltGr ) && (keynum !=Qt::Key_CapsLock ) &&
17  (keynum != Qt::Key_NumLock) && (keynum !=Qt::Key_ScrollLock ))
18  {
19  Qt::KeyboardModifiers modifiers;
20  // if modifiers have been pressed, rebuild keynum
21  if ((modifiers = Event->modifiers()) != Qt::NoModifier)
22  {
23  int modnum = Qt::NoModifier;
24  if (((modifiers & Qt::ShiftModifier) != 0U) &&
25  (keynum > 0x7f) &&
26  (keynum != Qt::Key_Backtab))
27  modnum |= Qt::SHIFT;
28  if ((modifiers & Qt::ControlModifier) != 0U)
29  modnum |= Qt::CTRL;
30  if ((modifiers & Qt::MetaModifier) != 0U)
31  modnum |= Qt::META;
32  if ((modifiers & Qt::AltModifier) != 0U)
33  modnum |= Qt::ALT;
34  modnum &= ~Qt::UNICODE_ACCEL;
35  return (keynum | modnum);
36  }
37  }
38 
39  return keynum;
40 }
mythmainwindowprivate.h
MythMainWindowPrivate::TranslateKeyNum
static int TranslateKeyNum(QKeyEvent *Event)
Definition: mythmainwindowprivate.cpp:8
Event
Event details.
Definition: zmdefines.h:27