Quantcast
Channel: Jobs
Viewing all articles
Browse latest Browse all 18427

Help reqested: very simple keypressevent in mainwindow

$
0
0
Hello I’ve been trying to add a basic keyboard input handler to my mainwindow. The mainwindow has a few Qlabels and pushbuttons, nothing fancy. I’ve tried adding the following code: mainwindow.h     protected:     void keyPressEvent(QKeyEvent *event); mainwindow.cpp     void MainWindow::keyPressEvent(QKeyEvent *event)     {     std::cout << "pressed";     } But nothing happens when I press a key. I think there’s something very simple that I’m missing, but I just can’t figure it out. Trust me I’ve googled quite a bit on the topic but got nowhere. Any help would be greatly appreciated. Thanks.

Viewing all articles
Browse latest Browse all 18427

Trending Articles