Qt: fixed keyPressEvent (ticket #803)
This commit is contained in:
parent
83a4a41cde
commit
77be493e45
@ -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()
|
||||
|
||||
|
@ -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<Qt::Key>(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<int>(asciiCode);
|
||||
}
|
||||
|
||||
//control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions
|
||||
|
@ -79,6 +79,7 @@
|
||||
#include <QRadioButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QMenu>
|
||||
#include <QtTest/QTest>
|
||||
|
||||
//start private enum
|
||||
enum {CV_MODE_NORMAL= 0, CV_MODE_OPENGL = 1};
|
||||
|
Loading…
x
Reference in New Issue
Block a user