From c80f262258b7846bf199887bcfdbb6dcfda6ad6f Mon Sep 17 00:00:00 2001 From: Piotr Mikolajczyk Date: Thu, 25 Feb 2021 15:36:29 +0100 Subject: Android: Add select and copy capability to read-only text widgets In case of a read-only text editing widget it was imposibble to copy text from it. In QtWidgets you could not even see the selection handless. Text selection in QtWidgets module was filtered depending on readOnly property of the widget. Additionally, in InputMethod the read-only state was translated into disabled. Patch also makes the edit menu to be aware of the read-only status of the control - the menu items are different for rw and ro controls. Task-number: QTBUG-91417 Change-Id: Ic7b27f78678eeaa87a38607af787f254db1383b8 Reviewed-by: Rami Potinkara Reviewed-by: Ville Voutilainen --- .../widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'tests/auto/widgets/widgets/qtextbrowser') diff --git a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp index 73266d77f3..ec187a55b0 100644 --- a/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp +++ b/tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp @@ -466,11 +466,29 @@ void tst_QTextBrowser::textInteractionFlags_vs_readOnly() void tst_QTextBrowser::inputMethodAttribute_vs_readOnly() { QVERIFY(browser->isReadOnly()); +#if defined(Q_OS_ANDROID) + QInputMethodQueryEvent query(Qt::ImReadOnly); + QCoreApplication::sendEvent(browser, &query); + QVERIFY(query.value(Qt::ImReadOnly).toBool()); +#else QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled)); +#endif + browser->setReadOnly(false); +#if defined(Q_OS_ANDROID) + QCoreApplication::sendEvent(browser, &query); + QVERIFY(!query.value(Qt::ImReadOnly).toBool()); +#else QVERIFY(browser->testAttribute(Qt::WA_InputMethodEnabled)); +#endif + browser->setReadOnly(true); +#if defined(Q_OS_ANDROID) + QCoreApplication::sendEvent(browser, &query); + QVERIFY(query.value(Qt::ImReadOnly).toBool()); +#else QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled)); +#endif } void tst_QTextBrowser::anchorsWithSelfBuiltHtml() -- cgit v1.2.3