keyPressEvent no reaction

前端 未结 1 1778
别跟我提以往
别跟我提以往 2021-01-21 22:00

I am writing on QT. OpenGL is connected, work properly, but the events and keyPressEvent mousePressEvent not respond to keystrokes.

class MainWindow : public QGL         


        
相关标签:
1条回答
  • 2021-01-21 22:57

    Make sure that the MainWindow accepts Focus by setting

    QWidget::setFocusPolicy()

    Also you should call the base implementation of QWidget::keyPressEvent as stated here. Is there another Widget which has the focus and does not pass the KeyEvent?

    0 讨论(0)
提交回复
热议问题