diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-15 09:19:56 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-04-15 09:19:56 (GMT) |
commit | 21099dac569348a15df2d6a5a61015b5afa17097 (patch) | |
tree | b4ae338f206666b7f07e1f78278ad6d38609880b /demos | |
parent | f169ca1020886707b04101300e365d79f38a6332 (diff) | |
parent | 4e78de5a4281bd1c27a984b13887975798573aae (diff) | |
download | Qt-21099dac569348a15df2d6a5a61015b5afa17097.zip Qt-21099dac569348a15df2d6a5a61015b5afa17097.tar.gz Qt-21099dac569348a15df2d6a5a61015b5afa17097.tar.bz2 |
Merge commit 'origin/4.5'
Conflicts:
src/gui/graphicsview/qgraphicsitem.cpp
Diffstat (limited to 'demos')
-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()); |