summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-05-08 02:28:36 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-05-08 02:28:36 (GMT)
commit54e7c7d8990a792e7f5bb4429dd48fba108ba24a (patch)
treef0426e5c1990fdfb3f44b6a67038dfaef742d946 /src/declarative/fx
parent9a69890dee24a26efde615e18f1ed7aa79eb441c (diff)
parent1e71ce9f221c739f03c9e6d49faf7cd7b0c85ae2 (diff)
downloadQt-54e7c7d8990a792e7f5bb4429dd48fba108ba24a.zip
Qt-54e7c7d8990a792e7f5bb4429dd48fba108ba24a.tar.gz
Qt-54e7c7d8990a792e7f5bb4429dd48fba108ba24a.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/qfxflickable.cpp12
-rw-r--r--src/declarative/fx/qfxflickable.h4
-rw-r--r--src/declarative/fx/qfxgridview.cpp21
-rw-r--r--src/declarative/fx/qfxgridview.h4
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp8
-rw-r--r--src/declarative/fx/qfxlistview.cpp24
-rw-r--r--src/declarative/fx/qfxlistview.h7
-rw-r--r--src/declarative/fx/qfxpathview.cpp12
8 files changed, 24 insertions, 68 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/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index 1bb54ec..848b2d9 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -94,9 +94,9 @@ QList<QFxItem *> *QFxKeyProxy::targets() const
void QFxKeyProxy::keyPressEvent(QKeyEvent *e)
{
for (int ii = 0; ii < d->targets.count(); ++ii) {
- QSimpleCanvasItem *i = d->targets.at(ii);
+ QSimpleCanvasItem *i = canvas()->focusItem(d->targets.at(ii));
if (i)
- canvas()->focusItem(i)->keyPressEvent(e);
+ i->keyPressEvent(e);
if (e->isAccepted())
return;
}
@@ -105,9 +105,9 @@ void QFxKeyProxy::keyPressEvent(QKeyEvent *e)
void QFxKeyProxy::keyReleaseEvent(QKeyEvent *e)
{
for (int ii = 0; ii < d->targets.count(); ++ii) {
- QSimpleCanvasItem *i = d->targets.at(ii);
+ QSimpleCanvasItem *i = canvas()->focusItem(d->targets.at(ii));
if (i)
- canvas()->focusItem(i)->keyReleaseEvent(e);
+ i->keyReleaseEvent(e);
if (e->isAccepted())
return;
}
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);
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index 2b39d6e..77d5fa2 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -157,7 +157,6 @@ void QFxPathView::setModel(const QVariant &model)
disconnect(d->model, SIGNAL(itemCreated(int, QFxItem*)), this, SLOT(itemCreated(int,QFxItem*)));
for (int i=0; i<d->items.count(); i++){
QFxItem *p = d->items[i];
- attachedProperties.remove(p);
d->model->release(p);
}
d->items.clear();
@@ -557,7 +556,6 @@ void QFxPathViewPrivate::regenerate()
Q_Q(QFxPathView);
for (int i=0; i<items.count(); i++){
QFxItem *p = items[i];
- q->attachedProperties.remove(p);
model->release(p);
}
items.clear();
@@ -631,7 +629,6 @@ void QFxPathView::refill()
while(wrapIndex-- >= 0){
QFxItem* p = d->items.takeFirst();
d->updateItem(p, 0.0);
- attachedProperties.remove(p);
d->model->release(p);
d->firstIndex++;
d->firstIndex %= d->model->count();
@@ -645,7 +642,6 @@ void QFxPathView::refill()
while(wrapIndex++ < d->items.count()-1){
QFxItem* p = d->items.takeLast();
d->updateItem(p, 1.0);
- attachedProperties.remove(p);
d->model->release(p);
d->firstIndex--;
if (d->firstIndex < 0)
@@ -704,7 +700,6 @@ void QFxPathView::itemsRemoved(int modelIndex, int count)
if (d->pathItems == -1) {
for (int i = 0; i < count; ++i) {
QFxItem* p = d->items.takeAt(modelIndex);
- attachedProperties.remove(p);
d->model->release(p);
}
d->snapToCurrent();
@@ -876,8 +871,11 @@ void QFxPathViewPrivate::snapToCurrent()
QHash<QObject*, QObject*> QFxPathView::attachedProperties;
QObject *QFxPathView::qmlAttachedProperties(QObject *obj)
{
- QFxPathViewAttached *rv = new QFxPathViewAttached(obj);
- attachedProperties.insert(obj, rv);
+ QObject *rv = attachedProperties.value(obj);
+ if (!rv) {
+ rv = new QFxPathViewAttached(obj);
+ attachedProperties.insert(obj, rv);
+ }
return rv;
}