From 9dfd621aec9a031297c50dd7df5ca90c771f46a3 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Tue, 2 Aug 2011 10:53:52 +1000 Subject: Call base class init() from QSGListViewPrivate Regression from 9b5f9c8056186c9cf3c40dbac66e5f90369339dc when QSGItemView was created. Also fixed other reimplemented methods in QSGListViewPrivate to call their base class functions (which are currently empty) and changed some virtual methods in QSGItemViewPrivate to non-virtual where they didn't need to be virtual. Task-number: QTBUG-20679 Change-Id: I489593b3eab4f5bbb4126906f170342d1e8811cd Reviewed-on: http://codereview.qt.nokia.com/2462 Reviewed-by: Bea Lam Reviewed-by: Qt Sanity Bot --- src/declarative/items/qsgitemview_p_p.h | 11 ++++++----- src/declarative/items/qsglistview.cpp | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/declarative/items/qsgitemview_p_p.h b/src/declarative/items/qsgitemview_p_p.h index 3113a8b754..96aec8f2c0 100644 --- a/src/declarative/items/qsgitemview_p_p.h +++ b/src/declarative/items/qsgitemview_p_p.h @@ -95,10 +95,10 @@ public: void adjustMoveParameters(int *from, int *to, int *count) const; virtual void init(); - virtual void updateCurrent(int modelIndex); virtual void clear(); - virtual void regenerate(); virtual void updateViewport(); + + void regenerate(); void layout(); void refill(); void refill(qreal from, qreal to, bool doBuffer = false); @@ -111,6 +111,7 @@ public: QSGItem *createHighlightItem(); QSGItem *createComponentItem(QDeclarativeComponent *component, bool receiveItemGeometryChanges, bool createDefault = false); + void updateCurrent(int modelIndex); void updateTrackedItem(); void updateUnrequestedIndexes(); void updateUnrequestedPositions(); @@ -191,14 +192,14 @@ protected: virtual void visibleItemsChanged() = 0; virtual FxViewItem *newViewItem(int index, QSGItem *item) = 0; - virtual void initializeViewItem(FxViewItem *) {} virtual void repositionPackageItemAt(QSGItem *item, int index) = 0; virtual void layoutVisibleItems() = 0; - - virtual void updateSections() {} virtual void changedVisibleIndex(int newIndex) = 0; + + virtual void initializeViewItem(FxViewItem *) {} virtual void initializeCurrentItem() {} + virtual void updateSections() {} virtual void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry); }; diff --git a/src/declarative/items/qsglistview.cpp b/src/declarative/items/qsglistview.cpp index 9c3ab2a285..15042bea91 100644 --- a/src/declarative/items/qsglistview.cpp +++ b/src/declarative/items/qsglistview.cpp @@ -455,6 +455,7 @@ void QSGListViewPrivate::changedVisibleIndex(int newIndex) void QSGListViewPrivate::init() { + QSGItemViewPrivate::init(); ::memset(sectionCache, 0, sizeof(QSGItem*) * sectionCacheSize); } @@ -498,6 +499,8 @@ FxViewItem *QSGListViewPrivate::newViewItem(int modelIndex, QSGItem *item) void QSGListViewPrivate::initializeViewItem(FxViewItem *item) { + QSGItemViewPrivate::initializeViewItem(item); + QSGItemPrivate *itemPrivate = QSGItemPrivate::get(item->item); itemPrivate->addItemChangeListener(this, QSGItemPrivate::Geometry); @@ -815,6 +818,8 @@ void QSGListViewPrivate::createSection(FxListItemSG *listItem) void QSGListViewPrivate::updateSections() { + QSGItemViewPrivate::updateSections(); + if (sectionCriteria && !visibleItems.isEmpty()) { QString prevSection; if (visibleIndex > 0) @@ -871,6 +876,8 @@ void QSGListViewPrivate::updateCurrentSection() void QSGListViewPrivate::initializeCurrentItem() { + QSGItemViewPrivate::initializeCurrentItem(); + if (currentItem) { FxListItemSG *listItem = static_cast(currentItem); -- cgit v1.2.3