简体   繁体   中英

QKeySequence::Backspace

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM