Qt: fixed keyPressEvent (ticket #803)

This commit is contained in:
Ilya Lysenkov
2011-06-17 09:26:53 +00:00
parent 83a4a41cde
commit 77be493e45
3 changed files with 8 additions and 11 deletions

View File

@@ -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