void QQuickTextEdit::loadCursorDelegate()
{
Q_D(QQuickTextEdit);
- if (d->cursorComponent->isLoading())
+ if (d->cursorComponent->isLoading() || !isComponentComplete())
return;
QDeclarativeContext *creationContext = d->cursorComponent->creationContext();
QObject *object = d->cursorComponent->create(creationContext ? creationContext : qmlContext(this));
updateSize();
d->dirty = false;
}
-
+ if (d->cursorComponent && d->cursorComponent->isReady())
+ loadCursorDelegate();
}
/*!
\qmlproperty bool QtQuick2::TextEdit::selectByMouse
--- /dev/null
+import QtQuick 2.0
+
+Rectangle {
+ property string localProperty
+}
--- /dev/null
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextEdit {
+ text: "Hello world!"
+ id: textEditObject;
+ objectName: "textEditObject"
+ cursorDelegate: Cursor {
+ id:cursorInstance;
+ objectName: "cursorInstance";
+ localProperty: contextualProperty;
+ }
+ }
+}
--- /dev/null
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextEdit {
+ text: "Hello world!"
+ id: textEditObject
+ objectName: "textEditObject"
+ cursorDelegate: Item {
+ id:cursorInstance
+ objectName: "cursorInstance"
+ property string localProperty: contextualProperty
+ }
+ }
+}
void linkActivated();
+ void cursorDelegate_data();
void cursorDelegate();
void cursorVisible();
void delegateLoading_data();
QCOMPARE(spy.count(), 2);
}
+void tst_qquicktextedit::cursorDelegate_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::newRow("out of line") << testFileUrl("cursorTest.qml");
+ QTest::newRow("in line") << testFileUrl("cursorTestInline.qml");
+ QTest::newRow("external") << testFileUrl("cursorTestExternal.qml");
+}
+
void tst_qquicktextedit::cursorDelegate()
{
- QQuickView view(testFileUrl("cursorTest.qml"));
+ QFETCH(QUrl, source);
+ QQuickView view(source);
view.show();
view.requestActivateWindow();
QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject");
--- /dev/null
+import QtQuick 2.0
+
+Rectangle {
+ property string localProperty
+}
--- /dev/null
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextInput {
+ text: "Hello world!"
+ id: textInputObject;
+ objectName: "textInputObject"
+ cursorDelegate: Cursor {
+ id:cursorInstance;
+ objectName: "cursorInstance";
+ localProperty: contextualProperty;
+ }
+ }
+}
--- /dev/null
+import QtQuick 2.0
+
+Rectangle { width: 300; height: 300; color: "white"
+ property string contextualProperty: "Hello"
+ TextInput {
+ text: "Hello world!"
+ id: textInputObject
+ objectName: "textInputObject"
+ cursorDelegate: Item {
+ id:cursorInstance
+ objectName: "cursorInstance"
+ property string localProperty: contextualProperty
+ }
+ }
+}
void inputMethods();
void passwordCharacter();
+ void cursorDelegate_data();
void cursorDelegate();
void cursorVisible();
void cursorRectangle();
delete textInput;
}
+void tst_qquicktextinput::cursorDelegate_data()
+{
+ QTest::addColumn<QUrl>("source");
+ QTest::newRow("out of line") << testFileUrl("cursorTest.qml");
+ QTest::newRow("in line") << testFileUrl("cursorTestInline.qml");
+ QTest::newRow("external") << testFileUrl("cursorTestExternal.qml");
+}
+
void tst_qquicktextinput::cursorDelegate()
{
- QQuickView view(testFileUrl("cursorTest.qml"));
+ QFETCH(QUrl, source);
+ QQuickView view(source);
view.show();
view.requestActivateWindow();
QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject");