summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativegridview.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-02-02 04:01:04 (GMT)
committerMartin Jones <martin.jones@nokia.com>2011-02-02 04:01:04 (GMT)
commit13d59acef59952e07d98c2947c25da33418c2465 (patch)
tree7b50f12cafbdf720cbab27d149830867b2fb3e99 /src/declarative/graphicsitems/qdeclarativegridview.cpp
parent08fc37fbb09173bad771b36d2be14a2a359c140e (diff)
downloadQt-13d59acef59952e07d98c2947c25da33418c2465.zip
Qt-13d59acef59952e07d98c2947c25da33418c2465.tar.gz
Qt-13d59acef59952e07d98c2947c25da33418c2465.tar.bz2
Changing header or footer failed to delete the previous.
Also ensure that the view is repositioned if the change of header results in the view being out of bounds. Task-number: QTBUG-16522 Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativegridview.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 6a6ff64..9aade98 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -1779,6 +1779,9 @@ void QDeclarativeGridView::setFooter(QDeclarativeComponent *footer)
Q_D(QDeclarativeGridView);
if (d->footerComponent != footer) {
if (d->footer) {
+ if (scene())
+ scene()->removeItem(d->footer->item);
+ d->footer->item->deleteLater();
delete d->footer;
d->footer = 0;
}
@@ -1786,6 +1789,7 @@ void QDeclarativeGridView::setFooter(QDeclarativeComponent *footer)
if (isComponentComplete()) {
d->updateFooter();
d->updateGrid();
+ d->fixupPosition();
}
emit footerChanged();
}
@@ -1811,6 +1815,9 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header)
Q_D(QDeclarativeGridView);
if (d->headerComponent != header) {
if (d->header) {
+ if (scene())
+ scene()->removeItem(d->header->item);
+ d->header->item->deleteLater();
delete d->header;
d->header = 0;
}
@@ -1819,6 +1826,7 @@ void QDeclarativeGridView::setHeader(QDeclarativeComponent *header)
d->updateHeader();
d->updateFooter();
d->updateGrid();
+ d->fixupPosition();
}
emit headerChanged();
}