summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-30 05:39:36 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-30 05:39:36 (GMT)
commitcaad9036009cd68e40ae469fb978ba6122cecb12 (patch)
tree818be609b0f07e6be2e6cc4dbd14bf3e6c1bd711
parentab625efe61c4bd4c59064648d75da6d46acdc762 (diff)
downloadQt-caad9036009cd68e40ae469fb978ba6122cecb12.zip
Qt-caad9036009cd68e40ae469fb978ba6122cecb12.tar.gz
Qt-caad9036009cd68e40ae469fb978ba6122cecb12.tar.bz2
More QFxItem cleanup.
-rw-r--r--src/declarative/fx/qfxitem.cpp14
-rw-r--r--src/declarative/fx/qfxitem.h3
-rw-r--r--src/declarative/fx/qfxkeyproxy.cpp12
-rw-r--r--src/declarative/fx/qfxrepeater.cpp11
-rw-r--r--src/declarative/fx/qfxrepeater.h2
5 files changed, 21 insertions, 21 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 7eaaf8e..569af43 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -446,8 +446,6 @@ void QFxItem::setParentItem(QFxItem *parent)
QObject::setParent(parent);
QGraphicsObject::setParentItem(parent);
-
- parentChanged(parent, oldParent);
}
/*!
@@ -1822,6 +1820,8 @@ QVariant QFxItem::itemChange(GraphicsItemChange change,
} else if (change == ItemChildAddedChange ||
change == ItemChildRemovedChange) {
childrenChanged();
+ } else if (change == ItemParentHasChanged) {
+ emit parentChanged();
}
return QGraphicsItem::itemChange(change, value);
@@ -1846,11 +1846,6 @@ void QFxItem::paintContents(QPainter &)
{
}
-void QFxItem::parentChanged(QFxItem *, QFxItem *)
-{
- emit parentChanged();
-}
-
/*!
\enum QFxItem::TransformOrigin
@@ -2115,9 +2110,4 @@ void QFxItemPrivate::gvAddMouseFilter()
q->installSceneEventFilter(q);
}
-QVariant QFxItem::inputMethodQuery(Qt::InputMethodQuery query) const
-{
- return QGraphicsItem::inputMethodQuery(query);
-}
-
QT_END_NAMESPACE
diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h
index 932d44c..ba3ab4f 100644
--- a/src/declarative/fx/qfxitem.h
+++ b/src/declarative/fx/qfxitem.h
@@ -226,8 +226,6 @@ public:
void setFocus(bool);
bool hasActiveFocus() const;
- QVariant inputMethodQuery(Qt::InputMethodQuery query) const; //### for KeyProxy
-
Q_SIGNALS:
void xChanged();
void yChanged();
@@ -257,7 +255,6 @@ protected:
virtual void classBegin();
virtual void componentComplete();
- virtual void parentChanged(QFxItem *, QFxItem *);
virtual void focusChanged(bool);
virtual void activeFocusChanged(bool);
virtual void keyPressEvent(QKeyEvent *event);
diff --git a/src/declarative/fx/qfxkeyproxy.cpp b/src/declarative/fx/qfxkeyproxy.cpp
index 0a9a151..85ecc39 100644
--- a/src/declarative/fx/qfxkeyproxy.cpp
+++ b/src/declarative/fx/qfxkeyproxy.cpp
@@ -179,12 +179,20 @@ void QFxKeyProxy::inputMethodEvent(QInputMethodEvent *e)
}
}
-QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const
+class QFxItemAccessor : public QFxItem
{
+public:
+ QVariant doInputMethodQuery(Qt::InputMethodQuery query) const {
+ return QFxItem::inputMethodQuery(query);
+ }
+};
+
+QVariant QFxKeyProxy::inputMethodQuery(Qt::InputMethodQuery query) const
+{
for (int ii = 0; ii < d->targets.count(); ++ii) {
QFxItem *i = qobject_cast<QFxItem *>(scene()->focusItem(d->targets.at(ii)));
if (i && (i->flags() & ItemAcceptsInputMethod) && i == d->imeItem) { //### how robust is i == d->imeItem check?
- QVariant v = i->inputMethodQuery(query);
+ QVariant v = static_cast<QFxItemAccessor*>(i)->doInputMethodQuery(query);
if (v.type() == QVariant::RectF)
v = mapRectFromItem(i, v.toRectF()); //### cost?
return v;
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index a231f20..8f30324 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -244,10 +244,15 @@ void QFxRepeater::componentComplete()
/*!
\internal
*/
-void QFxRepeater::parentChanged(QFxItem *o, QFxItem *n)
+QVariant QFxRepeater::itemChange(GraphicsItemChange change,
+ const QVariant &value)
{
- QFxItem::parentChanged(o, n);
- regenerate();
+ QVariant rv = QFxItem::itemChange(change, value);
+ if (change == ItemParentHasChanged) {
+ regenerate();
+ }
+
+ return rv;
}
/*!
diff --git a/src/declarative/fx/qfxrepeater.h b/src/declarative/fx/qfxrepeater.h
index 6f950d3..7fa914e 100644
--- a/src/declarative/fx/qfxrepeater.h
+++ b/src/declarative/fx/qfxrepeater.h
@@ -73,7 +73,7 @@ private:
protected:
virtual void componentComplete();
- virtual void parentChanged(QFxItem *, QFxItem *);
+ QVariant itemChange(GraphicsItemChange change, const QVariant &value);
QFxRepeater(QFxRepeaterPrivate &dd, QFxItem *parent);
private: