[mythtv] Shift key ignored in shortcuts

Oliver Maunder olly at roomaroo.co.uk
Mon Oct 27 17:00:05 UTC 2008

I'm trying to set up a new remote control at the moment. It's
recognised as a keyboard and most of the buttons send key combinations
- e.g. Stop sends Ctrl+Shift+S, Play sends Ctrl+Shift+P.

The problem is, any key combination containing Shift is ignored. Ctrl
or Alt are fine. I looked in the code and found this in

// Make keynum in QKeyEvent be equivalent to what's in QKeySequence
int MythMainWindowPrivate::TranslateKeyNum(QKeyEvent* e)
  int keynum = e->key();

  if (keynum != Qt::Key_Escape && (keynum <  Qt::Key_Shift || keynum >
     Qt::ButtonState modifiers;
     // if modifiers have been pressed, rebuild keynum
     if ((modifiers = e->state()) != 0)
        int modnum = (((modifiers & Qt::ShiftButton) &&
                             keynum > 0x7f) ? Qt::SHIFT : 0) |
                             ((modifiers & Qt::ControlButton) ? Qt::CTRL : 0) |
                             ((modifiers & Qt::MetaButton) ? Qt::META : 0) |
                             ((modifiers & Qt::AltButton) ? Qt::ALT : 0);
        modnum &= ~Qt::UNICODE_ACCEL;
        return (keynum |= modnum);

  return keynum;

So, if the keycode is less than 0x7f the shift modifier is ignored.
According to the docs at [1] all the ASCII characters are in the range
0x20 to 0x7e, so that > 0x7f excludes pretty much any key you'd want
to use in a shortcut!

Does anyone know the logic behind this? If no-one comes up with any
good justifications I'll raise a bug.


[1] http://doc.trolltech.com/4.3/qt.html#Key-enum

More information about the mythtv-dev mailing list