Fix creation context for delegates
authorBea Lam <bea.lam@nokia.com>
Fri, 14 Oct 2011 00:20:08 +0000 (10:20 +1000)
committerQt by Nokia <qt-info@nokia.com>
Fri, 14 Oct 2011 00:39:59 +0000 (02:39 +0200)
As per cdf868033bbd7bf5a996c67fa56f8ac15e755115 for ListView and
GridView.

Change-Id: I6928a1fd4df51265124925530e81704dbdc5af46
Reviewed-on: http://codereview.qt-project.org/6629
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/declarative/items/qsgpathview.cpp

index faa045a..590fa93 100644 (file)
@@ -211,7 +211,9 @@ void QSGPathViewPrivate::createHighlight()
 
     QSGItem *item = 0;
     if (highlightComponent) {
-        QDeclarativeContext *highlightContext = new QDeclarativeContext(qmlContext(q));
+        QDeclarativeContext *creationContext = highlightComponent->creationContext();
+        QDeclarativeContext *highlightContext = new QDeclarativeContext(
+                creationContext ? creationContext : qmlContext(q));
         QObject *nobj = highlightComponent->create(highlightContext);
         if (nobj) {
             QDeclarative_setParent_noEvent(highlightContext, nobj);