QKeySequence::Backspace

1.3k views Asked by At

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

1

There are 1 answers

0
Daniel Hedberg On BEST ANSWER

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);