//鍵盤事件返回一個ASCII碼:不區分大小寫
#include <QDebug> #include <QKeyEvent> void Widget::keyPressEvent(QKeyEvent *event) { int key = event->key(); qDebug() << key; char a = (char)key; qDebug() << (char)a; }