|
|
|
@ -1555,6 +1555,8 @@ CvWindow::CvWindow(QString name, int arg2) |
|
|
|
|
setWindowTitle(name); |
|
|
|
|
setObjectName(name); |
|
|
|
|
|
|
|
|
|
setFocus( Qt::PopupFocusReason ); //#1695 arrow keys are not recieved without the explicit focus
|
|
|
|
|
|
|
|
|
|
resize(400, 300); |
|
|
|
|
setMinimumSize(1, 1); |
|
|
|
|
|
|
|
|
@ -2060,22 +2062,18 @@ 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 = true; |
|
|
|
|
|
|
|
|
|
Qt::Key qtkey = static_cast<Qt::Key>(key); |
|
|
|
|
char asciiCode = QTest::keyToAscii(qtkey); |
|
|
|
|
if (asciiCode != 0) |
|
|
|
|
{ |
|
|
|
|
key = static_cast<int>(asciiCode); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
key = event->nativeVirtualKey(); //same codes as returned by GTK-based backend
|
|
|
|
|
|
|
|
|
|
//control plus (Z, +, -, up, down, left, right) are used for zoom/panning functions
|
|
|
|
|
if (event->modifiers() != Qt::ControlModifier && goodKey) |
|
|
|
|
if (event->modifiers() != Qt::ControlModifier) |
|
|
|
|
{ |
|
|
|
|
mutexKey.lock(); |
|
|
|
|
last_key = key; |
|
|
|
|
//last_key = event->nativeVirtualKey ();
|
|
|
|
|
mutexKey.unlock(); |
|
|
|
|
key_pressed.wakeAll(); |
|
|
|
|
//event->accept();
|
|
|
|
|