wasm: fix clipboard use
Change 5242126a inadvertantly removed clipboard functionality Change-Id: Ie15e08470dd51d1c166063bbd443fd04416b2786 Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
This commit is contained in:
parent
f6ce77f3e4
commit
15adc79bbc
@ -831,16 +831,30 @@ bool QWasmEventTranslator::processKeyboard(int eventType, const EmscriptenKeyboa
|
|||||||
if (keyType == QEvent::None)
|
if (keyType == QEvent::None)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
QFlags<Qt::KeyboardModifier> mods = translateKeyboardEventModifier(keyEvent);
|
||||||
bool accepted = false;
|
bool accepted = false;
|
||||||
|
|
||||||
if (keyText.isEmpty())
|
if (keyType == QEvent::KeyPress &&
|
||||||
keyText = QString(keyEvent->key);
|
mods.testFlag(Qt::ControlModifier)
|
||||||
if (keyText.size() > 1)
|
&& qtKey == Qt::Key_V) {
|
||||||
keyText.clear();
|
QWasmIntegration::get()->getWasmClipboard()->readTextFromClipboard();
|
||||||
accepted = QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(
|
} else {
|
||||||
0, keyType, qtKey, modifiers, keyText);
|
if (keyText.isEmpty())
|
||||||
|
keyText = QString(keyEvent->key);
|
||||||
|
if (keyText.size() > 1)
|
||||||
|
keyText.clear();
|
||||||
|
accepted = QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(
|
||||||
|
0, keyType, qtKey, modifiers, keyText);
|
||||||
|
}
|
||||||
|
if (keyType == QEvent::KeyPress &&
|
||||||
|
mods.testFlag(Qt::ControlModifier)
|
||||||
|
&& qtKey == Qt::Key_C) {
|
||||||
|
QWasmIntegration::get()->getWasmClipboard()->writeTextToClipboard();
|
||||||
|
}
|
||||||
|
|
||||||
QWasmEventDispatcher::maintainTimers();
|
QWasmEventDispatcher::maintainTimers();
|
||||||
return accepted ? 1 : 0;
|
|
||||||
|
return accepted;
|
||||||
}
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user