Created
February 1, 2016 20:44
-
-
Save pixaline/46cd2889a5668f47e4ac to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <QtCore> | |
#include <QApplication> | |
#include <QtGui> | |
#include <QMainWindow> | |
class MainWindow : public QMainWindow | |
{ | |
protected: | |
virtual void keyReleaseEvent ( QKeyEvent * event ){ | |
// on my systems, holding down a key for a long time will make | |
// it, randomly, show that it's not repeating. | |
// this prevents me to make functions that only work while the key is down. :( | |
qDebug() << event->modifiers() << event->key() << (event->key() == Qt::Key_Shift) << event->isAutoRepeat() << event->count(); | |
} | |
}; | |
int main(int argc, char *argv[]) | |
{ | |
QApplication a(argc, argv); | |
MainWindow mw; | |
mw.setAttribute(Qt::WA_KeyCompression, true); | |
mw.show(); | |
return a.exec(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment