Initialize input method for read-only QTextBrowser
Set input method attribute to be aligned with read-only value in QTextBrowser initialization Task-number: QTBUG-52071 Change-Id: If0e64bf09e2a2d505ed66fcbfb8cd12ae39844d3 Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>bb10
parent
4ccfb1eb92
commit
1bbbb682b5
|
|
@ -653,6 +653,7 @@ void QTextBrowserPrivate::init()
|
|||
#ifndef QT_NO_CURSOR
|
||||
viewport->setCursor(oldCursor);
|
||||
#endif
|
||||
q->setAttribute(Qt::WA_InputMethodEnabled, !q->isReadOnly());
|
||||
q->setUndoRedoEnabled(false);
|
||||
viewport->setMouseTracking(true);
|
||||
QObject::connect(q->document(), SIGNAL(contentsChanged()), q, SLOT(_q_documentModified()));
|
||||
|
|
|
|||
|
|
@ -92,6 +92,7 @@ private slots:
|
|||
void clearHistory();
|
||||
void sourceInsideLoadResource();
|
||||
void textInteractionFlags_vs_readOnly();
|
||||
void inputMethodAttribute_vs_readOnly();
|
||||
void anchorsWithSelfBuiltHtml();
|
||||
void relativeNonLocalUrls();
|
||||
void adjacentAnchors();
|
||||
|
|
@ -455,6 +456,16 @@ void tst_QTextBrowser::textInteractionFlags_vs_readOnly()
|
|||
QCOMPARE(browser->textInteractionFlags(), Qt::TextBrowserInteraction);
|
||||
}
|
||||
|
||||
void tst_QTextBrowser::inputMethodAttribute_vs_readOnly()
|
||||
{
|
||||
QVERIFY(browser->isReadOnly());
|
||||
QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled));
|
||||
browser->setReadOnly(false);
|
||||
QVERIFY(browser->testAttribute(Qt::WA_InputMethodEnabled));
|
||||
browser->setReadOnly(true);
|
||||
QVERIFY(!browser->testAttribute(Qt::WA_InputMethodEnabled));
|
||||
}
|
||||
|
||||
void tst_QTextBrowser::anchorsWithSelfBuiltHtml()
|
||||
{
|
||||
browser->setHtml("<p>Hello <a href=\"#anchor\">Link</a>"
|
||||
|
|
|
|||
Loading…
Reference in New Issue