diff options
author | Piotr Mikolajczyk <piotr.mikolajczyk@qt.io> | 2021-02-25 15:36:29 +0100 |
---|---|---|
committer | Piotr Mikolajczyk <piotr.mikolajczyk@qt.io> | 2021-03-30 10:35:59 +0200 |
commit | c80f262258b7846bf199887bcfdbb6dcfda6ad6f (patch) | |
tree | 509ec5a3dde42db3af4fa29f6a1fe7f154f85e98 /tests | |
parent | 9275edbc31a0ca83740df5b4450b7776c59012dc (diff) |
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 <rami.potinkara@qt.io>
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/widgets/qtextbrowser/tst_qtextbrowser.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
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() |