aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsgtextinput.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2011-09-30 17:17:49 +1000
committerQt by Nokia <qt-info@nokia.com>2011-10-12 04:38:36 +0200
commitb3f9f53ff12d7fd5fc5b667c6a58169d5de06939 (patch)
treef7a4cd5e3ad60e23955ecea351fa99bebd6c1173 /src/declarative/items/qsgtextinput.cpp
parentfee823ed6adc77db563468539b47b9d10e02e5c8 (diff)
Provide a context when constructing a TextInput cursor delegate.
Without a context the delegate won't be able to refer to any external properties. Task-number: QTBUG-21780 Change-Id: I7171787e677ce67466b311796693ed88bcacb718 Reviewed-on: http://codereview.qt-project.org/5837 Sanity-Review: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'src/declarative/items/qsgtextinput.cpp')
-rw-r--r--src/declarative/items/qsgtextinput.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/declarative/items/qsgtextinput.cpp b/src/declarative/items/qsgtextinput.cpp
index 71c414fe02..3f1d95a4fc 100644
--- a/src/declarative/items/qsgtextinput.cpp
+++ b/src/declarative/items/qsgtextinput.cpp
@@ -971,8 +971,11 @@ void QSGTextInput::createCursor()
if(d->cursorItem)
delete d->cursorItem;
- d->cursorItem = qobject_cast<QSGItem*>(d->cursorComponent->create());
+ QDeclarativeContext *creationContext = d->cursorComponent->creationContext();
+ QObject *object = d->cursorComponent->create(creationContext ? creationContext : qmlContext(this));
+ d->cursorItem = qobject_cast<QSGItem*>(object);
if(!d->cursorItem){
+ delete object;
qmlInfo(this, d->cursorComponent->errors()) << tr("Could not instantiate cursor delegate");
return;
}