From cce83e2985bbdfe33d04162c3e20243e10ece46a Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 8 May 2009 12:06:19 +1000 Subject: setWidth() and setHeight() lost their virtual at some point :-/ --- src/declarative/fx/qfxflickable.cpp | 12 ++++++------ src/declarative/fx/qfxflickable.h | 4 ++-- src/declarative/fx/qfxgridview.cpp | 21 +++------------------ src/declarative/fx/qfxgridview.h | 4 +--- src/declarative/fx/qfxlistview.cpp | 24 ++---------------------- src/declarative/fx/qfxlistview.h | 7 +------ 6 files changed, 15 insertions(+), 57 deletions(-) diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index 52b142b..890bb31 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -116,6 +116,8 @@ void QFxFlickablePrivate::init() QObject::connect(_flick, SIGNAL(topChanged()), q, SIGNAL(positionChanged())); QObject::connect(&elasticX, SIGNAL(updated()), q, SLOT(ticked())); QObject::connect(&elasticY, SIGNAL(updated()), q, SLOT(ticked())); + QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(heightChange())); + QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(widthChange())); } void QFxFlickablePrivate::fixupX() @@ -914,23 +916,21 @@ void QFxFlickable::setViewportWidth(int w) d->updateBeginningEnd(); } -void QFxFlickable::setWidth(int w) +void QFxFlickable::widthChange() { Q_D(QFxFlickable); - QFxItem::setWidth(w); if (d->vWidth < 0) { - d->_flick->setWidth(w); + d->_flick->setWidth(width()); emit viewportWidthChanged(); d->updateBeginningEnd(); } } -void QFxFlickable::setHeight(int h) +void QFxFlickable::heightChange() { Q_D(QFxFlickable); - QFxItem::setHeight(h); if (d->vHeight < 0) { - d->_flick->setHeight(h); + d->_flick->setHeight(height()); emit viewportHeightChanged(); d->updateBeginningEnd(); } diff --git a/src/declarative/fx/qfxflickable.h b/src/declarative/fx/qfxflickable.h index 1281788..c5a0593 100644 --- a/src/declarative/fx/qfxflickable.h +++ b/src/declarative/fx/qfxflickable.h @@ -133,8 +133,6 @@ public: qreal pageYPosition() const; qreal pageHeight() const; - virtual void setWidth(int); - virtual void setHeight(int); QFxItem *viewport(); Q_SIGNALS: @@ -165,6 +163,8 @@ protected Q_SLOTS: virtual void ticked(); void movementStarting(); void movementEnding(); + void heightChange(); + void widthChange(); protected: virtual qreal minXExtent() const; diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index acfb57e..9e6f2c9 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -319,6 +319,8 @@ void QFxGridViewPrivate::init() { Q_Q(QFxGridView); q->setOptions(QFxGridView::IsFocusRealm); + QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(sizeChange())); + QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(sizeChange())); } void QFxGridViewPrivate::clear() @@ -996,26 +998,9 @@ void QFxGridView::setCellHeight(int cellHeight) } } -/*! - \reimp -*/ -void QFxGridView::setHeight(int height) -{ - Q_D(QFxGridView); - QFxFlickable::setHeight(height); - if (isComponentComplete()) { - d->updateGrid(); - d->layout(); - } -} - -/*! - \reimp -*/ -void QFxGridView::setWidth(int width) +void QFxGridView::sizeChange() { Q_D(QFxGridView); - QFxFlickable::setWidth(width); if (isComponentComplete()) { d->updateGrid(); d->layout(); diff --git a/src/declarative/fx/qfxgridview.h b/src/declarative/fx/qfxgridview.h index c612804..2bbfc40 100644 --- a/src/declarative/fx/qfxgridview.h +++ b/src/declarative/fx/qfxgridview.h @@ -109,9 +109,6 @@ public: int cellHeight() const; void setCellHeight(int); - virtual void setHeight(int height); - virtual void setWidth(int width); - static QObject *qmlAttachedProperties(QObject *); Q_SIGNALS: @@ -134,6 +131,7 @@ private Q_SLOTS: void itemsInserted(int index, int count); void itemsRemoved(int index, int count); void destroyRemoved(); + void sizeChange(); private: void refill(); diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index b256c4a..ad752a7 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -356,6 +356,8 @@ void QFxListViewPrivate::init() { Q_Q(QFxListView); q->setOptions(QFxListView::IsFocusRealm); + QObject::connect(q, SIGNAL(heightChanged()), q, SLOT(refill())); + QObject::connect(q, SIGNAL(widthChanged()), q, SLOT(refill())); } void QFxListViewPrivate::clear() @@ -1190,28 +1192,6 @@ QString QFxListView::currentSection() const return d->currentSection; } -/*! - \reimp -*/ -void QFxListView::setHeight(int height) -{ - Q_D(QFxListView); - QFxFlickable::setHeight(height); - if (d->orient == Qt::Vertical && isComponentComplete()) - refill(); -} - -/*! - \reimp -*/ -void QFxListView::setWidth(int width) -{ - Q_D(QFxListView); - QFxFlickable::setWidth(width); - if (d->orient == Qt::Horizontal && isComponentComplete()) - refill(); -} - void QFxListView::viewportMoved() { Q_D(QFxListView); diff --git a/src/declarative/fx/qfxlistview.h b/src/declarative/fx/qfxlistview.h index f15db0c..40c2496 100644 --- a/src/declarative/fx/qfxlistview.h +++ b/src/declarative/fx/qfxlistview.h @@ -116,9 +116,6 @@ public: void setSectionExpression(const QString &); QString currentSection() const; - virtual void setHeight(int height); - virtual void setWidth(int width); - static QObject *qmlAttachedProperties(QObject *); Q_SIGNALS: @@ -137,10 +134,8 @@ protected: virtual void keyReleaseEvent(QKeyEvent *); virtual void componentComplete(); -private: - void refill(); - private Q_SLOTS: + void refill(); void trackedPositionChanged(); void itemResized(); void itemsInserted(int index, int count); -- cgit v0.12