diff options
-rw-r--r-- | src/android/jar/src/org/qtproject/qt/android/QtNative.java | 13 | ||||
-rw-r--r-- | tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtNative.java b/src/android/jar/src/org/qtproject/qt/android/QtNative.java index 201c40036c..eb398a7061 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtNative.java @@ -1045,9 +1045,16 @@ public class QtNative private static void clearClipData() { - if (Build.VERSION.SDK_INT >= 28 && m_clipboardManager != null) - m_clipboardManager.clearPrimaryClip(); - m_usePrimaryClip = false; + if (m_clipboardManager != null) { + if (Build.VERSION.SDK_INT >= 28) { + m_clipboardManager.clearPrimaryClip(); + } else { + String[] mimeTypes = { ClipDescription.MIMETYPE_UNKNOWN }; + ClipData data = new ClipData("", mimeTypes, new ClipData.Item(new Intent())); + m_clipboardManager.setPrimaryClip(data); + } + } + m_usePrimaryClip = false; } private static void setClipboardText(String text) { diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index 32e85abfbb..08883f8c34 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -1028,10 +1028,6 @@ void tst_QPlainTextEdit::copyAvailable() #endif ed->clear(); QApplication::clipboard()->clear(); -#ifdef Q_OS_ANDROID - if (QNativeInterface::QAndroidApplication::sdkVersion() < 28) - QEXPECT_FAIL("", "Before Android 9, there's no API to clear the clipboard ", Continue); -#endif QVERIFY(!ed->canPaste()); QSignalSpy spyCopyAvailabe(ed, SIGNAL(copyAvailable(bool))); |