#endif
emit q->selectionChanged();
}
- q->updateCursorRectangle(true);
}
void QQuickTextControlPrivate::_q_updateCurrentCharFormatAndSelection()
#endif
if (interactionFlags & Qt::TextEditable) {
- if (cursor.position() != oldCursorPos)
+ if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ q->updateCursorRectangle(true);
+ }
_q_updateCurrentCharFormatAndSelection();
#ifndef QT_NO_IM
if (qGuiApp)
#endif
} else if (cursor.position() != oldCursorPos) {
emit q->cursorPositionChanged();
+ q->updateCursorRectangle(true);
}
selectionChanged(true);
repaintOldAndNewSelection(oldSelection);
setClipboardSelection();
#endif
emit q->cursorPositionChanged();
+ q->updateCursorRectangle(true);
}
} else if (!sendMouseEventToInputContext(e, pos)) {
e->ignore();
void embeddedImages_data();
void emptytags_QTBUG_22058();
+ void cursorRectangle_QTBUG_38947();
private:
void simulateKeys(QWindow *window, const QList<Key> &keys);
QCOMPARE(input->text(), QString("<b>Bold<>"));
}
+void tst_qquicktextedit::cursorRectangle_QTBUG_38947()
+{
+ QQuickView window(testFileUrl("qtbug-38947.qml"));
+
+ window.show();
+ window.requestActivate();
+ QTest::qWaitForWindowExposed(&window);
+ QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(window.rootObject());
+ QVERIFY(edit);
+
+ QPoint from = edit->positionToRectangle(0).center().toPoint();
+ QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, from);
+
+ QSignalSpy spy(edit, SIGNAL(cursorRectangleChanged()));
+ QVERIFY(spy.isValid());
+
+ for (int i = i; i < edit->length() - 1; ++i) {
+ QRectF rect = edit->positionToRectangle(i);
+ QTest::mouseMove(&window, rect.center().toPoint());
+ QCOMPARE(edit->cursorRectangle(), rect);
+ QCOMPARE(spy.count(), i);
+ }
+
+ QPoint to = edit->positionToRectangle(edit->length() - 1).center().toPoint();
+ QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, to);
+}
+
QTEST_MAIN(tst_qquicktextedit)
#include "tst_qquicktextedit.moc"