diff --git a/src/platform/x11/x11platformclipboard.cpp b/src/platform/x11/x11platformclipboard.cpp index 873773c4a..71a8d5c25 100644 --- a/src/platform/x11/x11platformclipboard.cpp +++ b/src/platform/x11/x11platformclipboard.cpp @@ -149,24 +149,14 @@ void X11PlatformClipboard::setData(ClipboardMode mode, const QVariantMap &dataMa // WORKAROUND: Avoid getting X11 warning "QXcbClipboard: SelectionRequest too old". QCoreApplication::processEvents(); DummyClipboard::setData(mode, dataMap); - } else { + } else if (qobject_cast(qApp) == nullptr) { + // WORKAROUND: QClipboard::setMimeData() with a simple windowless + // QGuiAplication on Wayland does not work. const auto data = createMimeData(dataMap); const auto qmode = modeToQClipboardMode(mode); WaylandClipboard::instance()->setMimeData(data, qmode); - - // This makes pasting the clipboard work in own widgets. - const auto data2 = createMimeData(dataMap); - QGuiApplication::clipboard()->setMimeData(data2, qmode); - } -} - -void X11PlatformClipboard::setRawData(ClipboardMode mode, QMimeData *mimeData) -{ - if ( X11Info::isPlatformX11() ) { - DummyClipboard::setRawData(mode, mimeData); } else { - const auto qmode = modeToQClipboardMode(mode); - WaylandClipboard::instance()->setMimeData(mimeData, qmode); + DummyClipboard::setData(mode, dataMap); } } diff --git a/src/platform/x11/x11platformclipboard.h b/src/platform/x11/x11platformclipboard.h index cdc9996a1..dce41e506 100644 --- a/src/platform/x11/x11platformclipboard.h +++ b/src/platform/x11/x11platformclipboard.h @@ -21,7 +21,6 @@ class X11PlatformClipboard final : public DummyClipboard QVariantMap data(ClipboardMode mode, const QStringList &formats) const override; void setData(ClipboardMode mode, const QVariantMap &dataMap) override; - void setRawData(ClipboardMode mode, QMimeData *mimeData) override; bool isSelectionSupported() const override { return m_selectionSupported; }