diff options
author | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-05-11 12:16:25 (GMT) |
---|---|---|
committer | Janne Koskinen <janne.p.koskinen@digia.com> | 2009-05-11 12:16:25 (GMT) |
commit | f005af3b8c8405219b39bacd348d3861f1243aa8 (patch) | |
tree | a2d1f332de493d3d2cf0e0d1b3ad7c062176fe39 /demos/embeddeddialogs | |
parent | 8aaa0cbf3451dee7bc8e8276faad3b2f2954dc1c (diff) | |
parent | 565f2957fb049f2df0330fac72ec5335860b9c7f (diff) | |
download | Qt-f005af3b8c8405219b39bacd348d3861f1243aa8.zip Qt-f005af3b8c8405219b39bacd348d3861f1243aa8.tar.gz Qt-f005af3b8c8405219b39bacd348d3861f1243aa8.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts:
src/gui/widgets/qmenu_symbian.cpp
Diffstat (limited to 'demos/embeddeddialogs')
-rw-r--r-- | demos/embeddeddialogs/customproxy.cpp | 17 | ||||
-rw-r--r-- | demos/embeddeddialogs/customproxy.h | 1 | ||||
-rw-r--r-- | demos/embeddeddialogs/main.cpp | 1 |
3 files changed, 15 insertions, 4 deletions
diff --git a/demos/embeddeddialogs/customproxy.cpp b/demos/embeddeddialogs/customproxy.cpp index 56a0548..dd8766f 100644 --- a/demos/embeddeddialogs/customproxy.cpp +++ b/demos/embeddeddialogs/customproxy.cpp @@ -44,7 +44,7 @@ #include <QtGui> CustomProxy::CustomProxy(QGraphicsItem *parent, Qt::WindowFlags wFlags) - : QGraphicsProxyWidget(parent, wFlags), popupShown(false) + : QGraphicsProxyWidget(parent, wFlags), popupShown(false), currentPopup(0) { timeLine = new QTimeLine(250, this); connect(timeLine, SIGNAL(valueChanged(qreal)), @@ -111,8 +111,19 @@ bool CustomProxy::sceneEventFilter(QGraphicsItem *watched, QEvent *event) QVariant CustomProxy::itemChange(GraphicsItemChange change, const QVariant &value) { - if (change == ItemChildRemovedChange) - removeSceneEventFilter(this); + if (change == ItemChildAddedChange || change == ItemChildRemovedChange) { + if (change == ItemChildAddedChange) { + currentPopup = qVariantValue<QGraphicsItem *>(value); + currentPopup->setCacheMode(ItemCoordinateCache); + if (scene()) + currentPopup->installSceneEventFilter(this); + } else if (scene()) { + currentPopup->removeSceneEventFilter(this); + currentPopup = 0; + } + } else if (currentPopup && change == ItemSceneHasChanged) { + currentPopup->installSceneEventFilter(this); + } return QGraphicsProxyWidget::itemChange(change, value); } diff --git a/demos/embeddeddialogs/customproxy.h b/demos/embeddeddialogs/customproxy.h index 0a5fbaf..d324426 100644 --- a/demos/embeddeddialogs/customproxy.h +++ b/demos/embeddeddialogs/customproxy.h @@ -70,6 +70,7 @@ private slots: private: QTimeLine *timeLine; bool popupShown; + QGraphicsItem *currentPopup; }; #endif diff --git a/demos/embeddeddialogs/main.cpp b/demos/embeddeddialogs/main.cpp index 4cf7325..cfb31c4 100644 --- a/demos/embeddeddialogs/main.cpp +++ b/demos/embeddeddialogs/main.cpp @@ -68,7 +68,6 @@ int main(int argc, char *argv[]) proxy->setCacheMode(QGraphicsItem::DeviceCoordinateCache); scene.addItem(proxy); - proxy->installSceneEventFilter(proxy); } } scene.setSceneRect(scene.itemsBoundingRect()); |