summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-11-05 07:39:35 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-11-05 07:39:35 (GMT)
commitc7a886c4bc04bdbd470207d188499778d6380532 (patch)
tree1a2ffcbb41a838557b294977155889e1a5ed1618 /src
parent70ffa3d571c5085d2702cdd0b43f85ddb2c0b8eb (diff)
parent0bc45e6b54f67a3f5e8b7c3b780a124de1d9570d (diff)
downloadQt-c7a886c4bc04bdbd470207d188499778d6380532.zip
Qt-c7a886c4bc04bdbd470207d188499778d6380532.tar.gz
Qt-c7a886c4bc04bdbd470207d188499778d6380532.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners.cpp21
-rw-r--r--src/declarative/graphicsitems/qmlgraphicspositioners_p.h1
-rw-r--r--src/declarative/qml/qmlengine.cpp5
3 files changed, 19 insertions, 8 deletions
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
index d6f1fb9..3b975ba 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners.cpp
@@ -209,7 +209,12 @@ void QmlGraphicsBasePositioner::prePositioning()
QCoreApplication::postEvent(this, new QEvent(QEvent::User));
}
QSet<QmlGraphicsItem *> allItems;
+ //Need to order children by creation order modified by stacking order
+ //###can we avoid using the QGraphicsItemPrivate?
QList<QGraphicsItem *> children = childItems();
+ qSort(children.begin(), children.end(), d->insertionOrder);
+ positionedItems = QList<QmlGraphicsItem*>();
+
for (int ii = 0; ii < children.count(); ++ii) {
QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii));
if (!child)
@@ -234,6 +239,7 @@ void QmlGraphicsBasePositioner::prePositioning()
d->_newItems+=child;
}
allItems += child;
+ positionedItems << child;
}
QSet<QmlGraphicsItem *> deletedItems = d->_items - allItems;
foreach(QmlGraphicsItem *child, d->_items){
@@ -497,9 +503,9 @@ void QmlGraphicsColumn::doPositioning()
}
}
- QList<QGraphicsItem *> children = childItems();
+ QList<QmlGraphicsItem *> children = positionedItems;
for (int ii = 0; ii < children.count(); ++ii) {
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii));
+ QmlGraphicsItem *child = children.at(ii);
if (!child || isInvisible(child))
continue;
@@ -653,9 +659,9 @@ void QmlGraphicsRow::doPositioning()
applyRemove(changes, item);
}
}
- QList<QGraphicsItem *> children = childItems();
+ QList<QmlGraphicsItem *> children = positionedItems;
for (int ii = 0; ii < children.count(); ++ii) {
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(ii));
+ QmlGraphicsItem *child = children.at(ii);
if (!child || isInvisible(child))
continue;
@@ -859,7 +865,7 @@ void QmlGraphicsGrid::doPositioning()
QList<int> maxColWidth;
QList<int> maxRowHeight;
int childIndex =0;
- QList<QGraphicsItem *> children = childItems();
+ QList<QmlGraphicsItem *> children = positionedItems;
for (int i=0; i<r; i++){
for (int j=0; j<c; j++){
if (j==0)
@@ -869,7 +875,7 @@ void QmlGraphicsGrid::doPositioning()
if (childIndex == children.count())
continue;
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(children.at(childIndex++));
+ QmlGraphicsItem *child = children.at(childIndex++);
if (!child || isInvisible(child))
continue;
if (child->width() > maxColWidth[j])
@@ -889,8 +895,7 @@ void QmlGraphicsGrid::doPositioning()
applyRemove(changes, item);
}
}
- foreach(QGraphicsItem* schild, children){
- QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem *>(schild);
+ foreach(QmlGraphicsItem* child, children){
if (!child || isInvisible(child))
continue;
bool needMove = (child->x()!=xoffset)||(child->y()!=yoffset);
diff --git a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
index 0011ec5..56adc8b 100644
--- a/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
+++ b/src/declarative/graphicsitems/qmlgraphicspositioners_p.h
@@ -104,6 +104,7 @@ private Q_SLOTS:
protected:
QmlGraphicsBasePositioner(QmlGraphicsBasePositionerPrivate &dd, AutoUpdateType at, QmlGraphicsItem *parent);
void setMovingItem(QmlGraphicsItem *);
+ QList<QmlGraphicsItem *> positionedItems;
private:
void applyTransition(const QList<QPair<QString, QVariant> >& changes, QmlGraphicsItem* target,
diff --git a/src/declarative/qml/qmlengine.cpp b/src/declarative/qml/qmlengine.cpp
index 3df04b2..e46205d 100644
--- a/src/declarative/qml/qmlengine.cpp
+++ b/src/declarative/qml/qmlengine.cpp
@@ -626,6 +626,11 @@ QScriptValue QmlEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngi
url = QUrl(ctxt->argument(2).toString());
QObject *parentArg = activeEnginePriv->objectClass->toQObject(ctxt->argument(1));
QmlContext *qmlCtxt = qmlContext(parentArg);
+ if(!parentArg || !qmlCtxt){
+ //TODO: Could use a qmlInfo() like function for script functions
+ qWarning() << "createQmlObject called with invalid parent object";
+ return engine->nullValue();
+ }
if (url.isEmpty()) {
url = qmlCtxt->resolvedUrl(QUrl(QLatin1String("<Unknown File>")));
} else {