mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 02:56:50 +02:00
Apply fix from merge conflict to moved code
This commit is contained in:
parent
caf1a93354
commit
3242a7884c
1 changed files with 26 additions and 23 deletions
|
@ -988,31 +988,34 @@ static bool equals(const QByteArray& byteArray, const uint8_t* ptr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::synthesizeKeyPress(QString key) {
|
void OffscreenQmlSurface::synthesizeKeyPress(QString key) {
|
||||||
auto utf8Key = key.toUtf8();
|
auto eventHandler = getEventHandler();
|
||||||
|
if (eventHandler) {
|
||||||
|
auto utf8Key = key.toUtf8();
|
||||||
|
|
||||||
int scanCode = (int)utf8Key[0];
|
int scanCode = (int)utf8Key[0];
|
||||||
QString keyString = key;
|
QString keyString = key;
|
||||||
if (equals(utf8Key, UPWARDS_WHITE_ARROW_FROM_BAR) || equals(utf8Key, ASTERISIM) ||
|
if (equals(utf8Key, UPWARDS_WHITE_ARROW_FROM_BAR) || equals(utf8Key, ASTERISIM) ||
|
||||||
equals(utf8Key, (uint8_t*)PUNCTUATION_STRING) || equals(utf8Key, (uint8_t*)ALPHABET_STRING)) {
|
equals(utf8Key, (uint8_t*)PUNCTUATION_STRING) || equals(utf8Key, (uint8_t*)ALPHABET_STRING)) {
|
||||||
return; // ignore
|
return; // ignore
|
||||||
} else if (equals(utf8Key, LEFT_ARROW)) {
|
} else if (equals(utf8Key, LEFT_ARROW)) {
|
||||||
scanCode = Qt::Key_Backspace;
|
scanCode = Qt::Key_Backspace;
|
||||||
keyString = "\x08";
|
keyString = "\x08";
|
||||||
} else if (equals(utf8Key, RETURN_SYMBOL)) {
|
} else if (equals(utf8Key, RETURN_SYMBOL)) {
|
||||||
scanCode = Qt::Key_Return;
|
scanCode = Qt::Key_Return;
|
||||||
keyString = "\x0d";
|
keyString = "\x0d";
|
||||||
} else if (equals(utf8Key, LEFTWARD_WHITE_ARROW)) {
|
} else if (equals(utf8Key, LEFTWARD_WHITE_ARROW)) {
|
||||||
scanCode = Qt::Key_Left;
|
scanCode = Qt::Key_Left;
|
||||||
keyString = "";
|
keyString = "";
|
||||||
} else if (equals(utf8Key, RIGHTWARD_WHITE_ARROW)) {
|
} else if (equals(utf8Key, RIGHTWARD_WHITE_ARROW)) {
|
||||||
scanCode = Qt::Key_Right;
|
scanCode = Qt::Key_Right;
|
||||||
keyString = "";
|
keyString = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, scanCode, Qt::NoModifier, keyString);
|
||||||
|
QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, scanCode, Qt::NoModifier, keyString);
|
||||||
|
QCoreApplication::postEvent(eventHandler, pressEvent);
|
||||||
|
QCoreApplication::postEvent(eventHandler, releaseEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
QKeyEvent* pressEvent = new QKeyEvent(QEvent::KeyPress, scanCode, Qt::NoModifier, keyString);
|
|
||||||
QKeyEvent* releaseEvent = new QKeyEvent(QEvent::KeyRelease, scanCode, Qt::NoModifier, keyString);
|
|
||||||
QCoreApplication::postEvent(getEventHandler(), pressEvent);
|
|
||||||
QCoreApplication::postEvent(getEventHandler(), releaseEvent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool numeric) {
|
void OffscreenQmlSurface::setKeyboardRaised(QObject* object, bool raised, bool numeric) {
|
||||||
|
|
Loading…
Reference in a new issue