diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index a1469aa93..ff65a7135 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -110,7 +110,7 @@ if (HAVE_QT) SET(_MOC_HEADERS src/window_QT.h ) QT4_WRAP_CPP(_MOC_OUTFILES ${_MOC_HEADERS}) - set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES}) + set(HIGHGUI_LIBRARIES ${HIGHGUI_LIBRARIES} ${QT_LIBRARIES} ${QT_QTTEST_LIBRARY}) set(highgui_srcs ${highgui_srcs} src/window_QT.cpp ${_MOC_OUTFILES} ${_RCC_OUTFILES} ) endif() diff --git a/modules/highgui/src/window_QT.cpp b/modules/highgui/src/window_QT.cpp index 91e6288d7..d97928c50 100755 --- a/modules/highgui/src/window_QT.cpp +++ b/modules/highgui/src/window_QT.cpp @@ -1869,18 +1869,14 @@ void CvWindow::keyPressEvent(QKeyEvent *event) { //see http://doc.trolltech.com/4.6/qt.html#Key-enum int key = event->key(); - bool goodKey = false; + //bool goodKey = false; + bool goodKey = true; - if (key>=20 && key<=255 ) + Qt::Key qtkey = static_cast(key); + char asciiCode = QTest::keyToAscii(qtkey); + if(asciiCode != 0) { - key = (int)event->text().toLocal8Bit().at(0); - goodKey = true; - } - - if (key == Qt::Key_Escape) - { - key = 27; - goodKey = true; + key = static_cast(asciiCode); } //control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions diff --git a/modules/highgui/src/window_QT.h b/modules/highgui/src/window_QT.h index 80de075c4..282bb24d3 100644 --- a/modules/highgui/src/window_QT.h +++ b/modules/highgui/src/window_QT.h @@ -79,6 +79,7 @@ #include #include #include +#include //start private enum enum {CV_MODE_NORMAL= 0, CV_MODE_OPENGL = 1};