參考於:Qt 獲取組合鍵 鍵盤按住某鍵 滑鼠組合實現 - Andy5020 - 部落格園
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::MainWindow) { ui->setupUi(this); QWidget::installEventFilter(this); } bool MainWindow::eventFilter(QObject *watched, QEvent *event){ if(event->type()==event->KeyPress){ QKeyEvent *keyEvent = (QKeyEvent *)event; if(keyEvent->key() == Qt::Key_S && (keyEvent->modifiers() & Qt::ControlModifier)){ qDebug()<<"Enter + S"; return true; } } return false; }