class MyLabel : public QLabel { public: void keyPressEvent(QKeyEvent* pe) { if (pe ->key() == 0x5A) qDebug() << "Z"; }};