summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-12-01 07:30:52 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-12-01 07:30:52 (GMT)
commit1337a3e031477aa4d628d01252557dee622629ff (patch)
tree806bfbd9aa75ed94adddac06d4213e820b8a3eaf /src/declarative
parente46bf51f830dcc80932b9219fe608d1bc1a388ad (diff)
downloadQt-1337a3e031477aa4d628d01252557dee622629ff.zip
Qt-1337a3e031477aa4d628d01252557dee622629ff.tar.gz
Qt-1337a3e031477aa4d628d01252557dee622629ff.tar.bz2
ListView header is not visible initially.
If the header size was not set explicitly, but determined implicitly from Text height, the view was not positioned so that the header was visible when first shown. Task-number: QTBUG-15599 Reviewed-by: Bea Lam
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp16
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp22
2 files changed, 26 insertions, 12 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 4454284..1615b0f 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1769,8 +1769,10 @@ void QDeclarativeGridView::setFooter(QDeclarativeComponent *footer)
d->footer = 0;
}
d->footerComponent = footer;
- d->updateFooter();
- d->updateGrid();
+ if (isComponentComplete()) {
+ d->updateFooter();
+ d->updateGrid();
+ }
emit footerChanged();
}
}
@@ -1799,9 +1801,11 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header)
d->header = 0;
}
d->headerComponent = header;
- d->updateHeader();
- d->updateFooter();
- d->updateGrid();
+ if (isComponentComplete()) {
+ d->updateHeader();
+ d->updateFooter();
+ d->updateGrid();
+ }
emit headerChanged();
}
}
@@ -2226,6 +2230,8 @@ void QDeclarativeGridView::componentComplete()
{
Q_D(QDeclarativeGridView);
QDeclarativeFlickable::componentComplete();
+ d->updateHeader();
+ d->updateFooter();
d->updateGrid();
if (d->isValid()) {
refill();
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index d1f52be..845da79 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -402,6 +402,8 @@ public:
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) {
Q_Q(QDeclarativeListView);
QDeclarativeFlickablePrivate::itemGeometryChanged(item, newGeometry, oldGeometry);
+ if (!q->isComponentComplete())
+ return;
if (item != contentItem && (!highlight || item != highlight->item)) {
if ((orient == QDeclarativeListView::Vertical && newGeometry.height() != oldGeometry.height())
|| (orient == QDeclarativeListView::Horizontal && newGeometry.width() != oldGeometry.width())) {
@@ -1123,8 +1125,6 @@ void QDeclarativeListViewPrivate::updateHeader()
QDeclarativeItemPrivate *itemPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(item));
itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
header = new FxListItem(item, q);
- if (visibleItems.isEmpty())
- visiblePos = header->size();
}
}
if (header) {
@@ -1137,6 +1137,8 @@ void QDeclarativeListViewPrivate::updateHeader()
header->setPosition(startPos - header->size());
}
} else {
+ if (itemCount == 0)
+ visiblePos = header->size();
header->setPosition(0);
}
}
@@ -2215,8 +2217,10 @@ void QDeclarativeListView::setFooter(QDeclarativeComponent *footer)
d->footerComponent = footer;
d->minExtentDirty = true;
d->maxExtentDirty = true;
- d->updateFooter();
- d->updateViewport();
+ if (isComponentComplete()) {
+ d->updateFooter();
+ d->updateViewport();
+ }
emit footerChanged();
}
}
@@ -2247,9 +2251,11 @@ void QDeclarativeListView::setHeader(QDeclarativeComponent *header)
d->headerComponent = header;
d->minExtentDirty = true;
d->maxExtentDirty = true;
- d->updateHeader();
- d->updateFooter();
- d->updateViewport();
+ if (isComponentComplete()) {
+ d->updateHeader();
+ d->updateFooter();
+ d->updateViewport();
+ }
emit headerChanged();
}
}
@@ -2659,6 +2665,8 @@ void QDeclarativeListView::componentComplete()
Q_D(QDeclarativeListView);
QDeclarativeFlickable::componentComplete();
updateSections();
+ d->updateHeader();
+ d->updateFooter();
if (d->isValid()) {
refill();
d->moveReason = QDeclarativeListViewPrivate::SetIndex;