summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-05-13 00:08:11 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-05-13 00:08:11 (GMT)
commitf2b0e6ed97b962f9d6412acaa473f51ba4e23da0 (patch)
tree5eac3ab5a0c1f2a75c68e6d36472a54014ffbccc /src/declarative
parentf8c06c96b698392bea24f388840dec03274cb14b (diff)
parenta47bf3d15b589414183a0aa51c710c3763d3d1d1 (diff)
downloadQt-f2b0e6ed97b962f9d6412acaa473f51ba4e23da0.zip
Qt-f2b0e6ed97b962f9d6412acaa473f51ba4e23da0.tar.gz
Qt-f2b0e6ed97b962f9d6412acaa473f51ba4e23da0.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxlistview.cpp33
-rw-r--r--src/declarative/fx/qfxpath.cpp23
-rw-r--r--src/declarative/fx/qfxvisualitemmodel.cpp13
-rw-r--r--src/declarative/qml/qmlvme.cpp1
4 files changed, 43 insertions, 27 deletions
diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp
index fcd6e1f..46166e2 100644
--- a/src/declarative/fx/qfxlistview.cpp
+++ b/src/declarative/fx/qfxlistview.cpp
@@ -438,6 +438,7 @@ FxListItem *QFxListViewPrivate::createItem(int modelIndex)
else
QObject::connect(listItem->item, SIGNAL(widthChanged()), q, SLOT(itemResized()));
}
+
return listItem;
}
@@ -484,7 +485,8 @@ void QFxListViewPrivate::refill(qreal from, qreal to)
int pos = itemEnd + 1;
while (modelIndex < model->count() && pos <= to) {
//qDebug() << "refill: append item" << modelIndex;
- item = getItem(modelIndex);
+ if (!(item = getItem(modelIndex)))
+ break;
item->setPosition(pos);
pos += item->size();
visibleItems.append(item);
@@ -493,7 +495,8 @@ void QFxListViewPrivate::refill(qreal from, qreal to)
}
while (visibleIndex > 0 && visibleIndex <= model->count() && visiblePos > from) {
//qDebug() << "refill: prepend item" << visibleIndex-1 << "current top pos" << visiblePos;
- item = getItem(visibleIndex-1);
+ if (!(item = getItem(visibleIndex-1)))
+ break;
--visibleIndex;
visiblePos -= item->size();
item->setPosition(visiblePos);
@@ -719,26 +722,30 @@ void QFxListViewPrivate::updateCurrent(int modelIndex)
currentItem = visibleItem(modelIndex);
if (!currentItem) {
currentItem = getItem(modelIndex);
- if (modelIndex == visibleIndex - 1) {
- // We can calculate exact postion in this case
- currentItem->setPosition(visibleItems.first()->position() - currentItem->size());
- } else {
- // Create current item now and position as best we can.
- // Its position will be corrected when it becomes visible.
- currentItem->setPosition(positionAt(modelIndex));
+ if (currentItem) {
+ if (modelIndex == visibleIndex - 1) {
+ // We can calculate exact postion in this case
+ currentItem->setPosition(visibleItems.first()->position() - currentItem->size());
+ } else {
+ // Create current item now and position as best we can.
+ // Its position will be corrected when it becomes visible.
+ currentItem->setPosition(positionAt(modelIndex));
+ }
}
}
currentIndex = modelIndex;
fixCurrentVisibility = true;
- if (oldCurrentItem && oldCurrentItem->item != currentItem->item)
+ if (oldCurrentItem && (!currentItem || oldCurrentItem->item != currentItem->item))
oldCurrentItem->attached->setIsCurrentItem(false);
- currentItem->item->setFocus(true);
- currentItem->attached->setIsCurrentItem(true);
+ if (currentItem) {
+ currentItem->item->setFocus(true);
+ currentItem->attached->setIsCurrentItem(true);
+ }
updateHighlight();
emit q->currentIndexChanged();
// Release the old current item
if (oldCurrentItem && !visibleItem(oldCurrentIndex)) {
- if (oldCurrentItem->item == currentItem->item)
+ if (!currentItem || oldCurrentItem->item == currentItem->item)
delete oldCurrentItem;
else
releaseItem(oldCurrentItem);
diff --git a/src/declarative/fx/qfxpath.cpp b/src/declarative/fx/qfxpath.cpp
index e11658c..5bbdf64 100644
--- a/src/declarative/fx/qfxpath.cpp
+++ b/src/declarative/fx/qfxpath.cpp
@@ -478,16 +478,19 @@ void QFxCurve::setY(qreal y)
\qmlclass PathAttribute
\brief The PathAttribute allows setting an attribute at a given position in a Path.
- The PathAttribute object allows attibutes consisting of a name and a
- value to be specified for the endpoints of path segments. The attributes
- are exposed to the delegate as \l {Attached Properties}. The value of
- an attribute at any particular point is interpolated from the PathAttributes
- bounding the point.
-
- The example below shows a path with the items scaled to 30% with opacity 50%
- at the top of the path and scaled 100% with opacity 100% at the bottom.
- Note the use of the PathView.scale and PathView.opacity attached properties
- to set the scale and opacity of the delegate.
+ The PathAttribute object allows attibutes consisting of a name and
+ a value to be specified for the endpoints of path segments. The
+ attributes are exposed to the delegate as
+ \l{qmlintroduction.html#attached-properties} {Attached Properties}.
+ The value of an attribute at any particular point is interpolated
+ from the PathAttributes bounding the point.
+
+ The example below shows a path with the items scaled to 30% with
+ opacity 50% at the top of the path and scaled 100% with opacity
+ 100% at the bottom. Note the use of the PathView.scale and
+ PathView.opacity attached properties to set the scale and opacity
+ of the delegate.
+
\table
\row
\o \image declarative-pathattribute.png
diff --git a/src/declarative/fx/qfxvisualitemmodel.cpp b/src/declarative/fx/qfxvisualitemmodel.cpp
index 61f08de..533917e 100644
--- a/src/declarative/fx/qfxvisualitemmodel.cpp
+++ b/src/declarative/fx/qfxvisualitemmodel.cpp
@@ -512,12 +512,17 @@ QFxItem *QFxVisualItemModel::item(int index, const QByteArray &viewId, bool comp
nobj = d->m_delegate->beginCreate(ctxt);
if (complete)
d->m_delegate->completeCreate();
- ctxt->setParent(nobj);
- data->setParent(nobj);
+ if (nobj) {
+ ctxt->setParent(nobj);
+ data->setParent(nobj);
- d->m_cache.insert(index, nobj);
+ d->m_cache.insert(index, nobj);
+ } else {
+ delete data;
+ delete ctxt;
+ qWarning() << d->m_delegate->errors();
+ }
}
-
QFxItem *item = qobject_cast<QFxItem *>(nobj);
if (!item) {
QmlPackage *package = qobject_cast<QmlPackage *>(nobj);
diff --git a/src/declarative/qml/qmlvme.cpp b/src/declarative/qml/qmlvme.cpp
index dc9ef06..a0bce0a 100644
--- a/src/declarative/qml/qmlvme.cpp
+++ b/src/declarative/qml/qmlvme.cpp
@@ -1063,6 +1063,7 @@ QObject *QmlVME::run(QmlContext *ctxt, QmlCompiledComponent *comp, int start, in
QmlEnginePrivate::clear(bindValues);
QmlEnginePrivate::clear(parserStatus);
+ qWarning() << errors().at(0);
return 0;
}