//头文件
#include<QKeyEvent>
//重写
void keyPressEvent(QKeyEvent *k)
{ //如果键盘按下ctrl和s 则保存文件
if(k->modifiers()==Qt::ControlModifier&&k->key()==Qt::Key_S)
{
SAVE_ActionSlot();
}
}
//modifiers()函数与枚举Qt::KeyboardModifier
enum KeyboardModifier {
NoModifier = 0x00000000,
ShiftModifier = 0x02000000,
ControlModifier = 0x04000000,
AltModifier = 0x08000000,
MetaModifier = 0x10000000,
KeypadModifier = 0x20000000,
GroupSwitchModifier = 0x40000000,
// Do not extend the mask to include 0x01000000
KeyboardModifierMask = 0xfe000000
};
Qt::Key_F1
Qt::Key_Space
Qt::Key_0
Qt::Key_A