diff options
author | Samuel Rødal <sroedal@trolltech.com> | 2008-12-04 15:43:14 +0100 |
---|---|---|
committer | Samuel Rødal <sroedal@trolltech.com> | 2008-12-04 15:45:44 +0100 |
commit | 7a0aaa3f8c192bb3f1c8b976325c696a9dc81994 (patch) | |
tree | e1f208cefda1cd92b1015652de7064a162c2a440 /mazescene.cpp | |
parent | 49fb6ed12422d48cf3b32d5c7bfbed3ba6b4e354 (diff) |
Fix missing widgets bug on Windows/Mac.
Diffstat (limited to 'mazescene.cpp')
-rw-r--r-- | mazescene.cpp | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/mazescene.cpp b/mazescene.cpp index 3e0972d..6fb126a 100644 --- a/mazescene.cpp +++ b/mazescene.cpp @@ -289,6 +289,27 @@ protected: } }; +class ProxyWidget : public QGraphicsProxyWidget +{ +public: + ProxyWidget(QGraphicsItem *parent = 0) + : QGraphicsProxyWidget(parent) + { + } + +protected: + QVariant itemChange(GraphicsItemChange change, const QVariant & value) + { + // we want the position of proxy widgets to stay at (0, 0) + // so ignore the position changes from the native QWidget + if (change == ItemPositionChange) + return QPointF(); + else + return QGraphicsProxyWidget::itemChange(change, value); + } +}; + + WallItem::WallItem(MazeScene *scene, const QPointF &a, const QPointF &b, int type) : ProjectedItem(QRectF(-0.5, -0.5, 1.0, 1.0)) , m_type(type) @@ -385,7 +406,7 @@ WallItem::WallItem(MazeScene *scene, const QPointF &a, const QPointF &b, int typ childWidget->installEventFilter(scene); - m_childItem = new QGraphicsProxyWidget(this); + m_childItem = new ProxyWidget(this); m_childItem->setWidget(childWidget); m_childItem->setCacheMode(QGraphicsItem::ItemCoordinateCache); |