diff options
| author | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-09-06 12:56:42 +0200 |
|---|---|---|
| committer | Mikolaj Boc <mikolaj.boc@qt.io> | 2022-09-09 19:06:40 +0200 |
| commit | adebdd0f9af0ffe47250b4a273407b84a6c61879 (patch) | |
| tree | 23af378f198a56c19d857935ec079e2050f75544 /src/plugins/platforms/wasm/qwasmclipboard.cpp | |
| parent | 124522a0a575f52172de841068d8e949703edb37 (diff) | |
Propagate the copy event correctly to Qt widgets on WASM
The event should be propagated when the native clipboard is available.
A recent regression caused it to be suppressed, which resulted in lack
of copy/paste capabilities.
Pick-to: 6.4 6.4.0
Change-Id: I030a31aa0951c3813ce1d38da9a6526010b3bfc8
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Diffstat (limited to 'src/plugins/platforms/wasm/qwasmclipboard.cpp')
| -rw-r--r-- | src/plugins/platforms/wasm/qwasmclipboard.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/platforms/wasm/qwasmclipboard.cpp b/src/plugins/platforms/wasm/qwasmclipboard.cpp index 97a0547563c..d290fe245b1 100644 --- a/src/plugins/platforms/wasm/qwasmclipboard.cpp +++ b/src/plugins/platforms/wasm/qwasmclipboard.cpp @@ -183,6 +183,21 @@ void QWasmClipboard::setMimeData(QMimeData *mimeData, QClipboard::Mode mode) isPaste = false; } +bool QWasmClipboard::processKeyboard(const QWasmEventTranslator::TranslatedEvent &event, + const QFlags<Qt::KeyboardModifier> &modifiers) +{ + // Clipboard path: cut/copy/paste are handled by clipboard event or direct clipboard + // access. + if (hasClipboardApi) + return false; + if (event.type != QEvent::KeyPress || !modifiers.testFlag(Qt::ControlModifier) + || (event.key != Qt::Key_C && event.key != Qt::Key_V && event.key != Qt::Key_X)) { + return false; + } + isPaste = event.key == Qt::Key_V; + return true; +} + bool QWasmClipboard::supportsMode(QClipboard::Mode mode) const { return mode == QClipboard::Clipboard; |
