3

In Qt, QKeySequence::Delete corresponds to deleteForward: message in MacOS.

What is the Qt equivalent of deleteBackward: from MacOS? If there is no such thing, how to capture the deleteBackward: event in Qt?

Qt documentation on key sequences does not mention this: http://qt-project.org/doc/qt-5.0/qtgui/qkeysequence.html

Daniel Hedberg
  • 5,677
  • 4
  • 36
  • 61
Ecir Hana
  • 10,864
  • 13
  • 67
  • 117

1 Answers1

1

QKeySequence has a constructor that takes key codes:

QKeySequence::QKeySequence(int k1, int k2 = 0, int k3 = 0, int k4 = 0)

For deleteBackward: you would use the Qt::Key_Backspace key code. If you for example whish to create a shortcut for a QAction object:

myAction->setShortcut(QKeySequence(Qt::Key_Backspace));

or simply:

myAction->setShortcut(Qt::Key_Backspace);
Daniel Hedberg
  • 5,677
  • 4
  • 36
  • 61