From a4b0ac2af03f4a78469a3dc0e04f785cde4ab381 Mon Sep 17 00:00:00 2001 From: Andrew den Exter Date: Tue, 14 Feb 2012 12:55:38 +1000 Subject: Fix access to context properties within TextEdit.cursorDelegate Don't create the cursorDelegate instance before componentComplete as the context may not be fully populated prior to that. Task-number: QTBUG-21780 Change-Id: I6ca8a24989bc28e5c5ca06d61a85e32ff630ce7c Reviewed-by: Martin Jones --- src/quick/items/qquicktextedit.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp index 5343715c3a..b9ff18e3d3 100644 --- a/src/quick/items/qquicktextedit.cpp +++ b/src/quick/items/qquicktextedit.cpp @@ -960,7 +960,7 @@ void QQuickTextEdit::setCursorDelegate(QDeclarativeComponent* c) 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)); @@ -1164,7 +1164,8 @@ void QQuickTextEdit::componentComplete() updateSize(); d->dirty = false; } - + if (d->cursorComponent && d->cursorComponent->isReady()) + loadCursorDelegate(); } /*! \qmlproperty bool QtQuick2::TextEdit::selectByMouse -- cgit v1.2.3