Hi!
I just tried this. Works fine here. The Shift-Key-Press event is sent immediately - regardless whether I hold it down to press another key or release it immediately.
main.h:
#ifndef MAIN_H
#define MAIN_H
#include <QtGui>
{
protected:
virtual void keyPressEvent
( QKeyEvent * event
) {
qDebug() << event->modifiers() << event->key() << (event->key() == Qt::Key_Shift) << event->isAutoRepeat();
}
};
#endif // MAIN_H
main.cpp
#include <QtCore>
#include <QtGui>
#include "main.h"
int main(int argc, char *argv[])
{
MainWindow mw;
mw.show();
return a.exec();
}
main.h:
#ifndef MAIN_H
#define MAIN_H
#include <QtGui>
class MainWindow : public QMainWindow
{
protected:
virtual void keyPressEvent ( QKeyEvent * event )
{
qDebug() << event->modifiers() << event->key() << (event->key() == Qt::Key_Shift) << event->isAutoRepeat();
}
};
#endif // MAIN_H
main.cpp
#include <QtCore>
#include <QtGui>
#include "main.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow mw;
mw.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
I'm on Win7x64 Qt 4.71 Mingw.
Joh
Bookmarks