summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-05-19 13:31:25 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2010-05-19 13:31:25 (GMT)
commit78dcac759d500c1744751955623b1d0babcd37a4 (patch)
tree59d7a2540c2fcffe0b274afbf85db9a1f53242f4 /src/gui/graphicsview
parentf1c79b3c90c1e14d8bee0228e3e416fa5337cf6e (diff)
parentde0858687898f6e0e54cce3f986779c7aa1a350e (diff)
downloadQt-78dcac759d500c1744751955623b1d0babcd37a4.zip
Qt-78dcac759d500c1744751955623b1d0babcd37a4.tar.gz
Qt-78dcac759d500c1744751955623b1d0babcd37a4.tar.bz2
Merge remote branch 'origin/4.7' into HEAD
Conflicts: src/corelib/tools/qlocale_symbian.cpp
Diffstat (limited to 'src/gui/graphicsview')
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp12
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.h1
4 files changed, 16 insertions, 7 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index a362d99..dfd58b3 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -3656,6 +3656,8 @@ void QGraphicsItem::setPos(const QPointF &pos)
// Update and repositition.
if (!(d_ptr->flags & (ItemSendsGeometryChanges | ItemSendsScenePositionChanges))) {
d_ptr->setPosHelper(pos);
+ if (d_ptr->isWidget)
+ static_cast<QGraphicsWidget *>(this)->d_func()->setGeometryFromSetPos();
return;
}
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 478c0c3..c486c45 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1096,13 +1096,7 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant &
}
break;
case ItemPositionHasChanged:
- if (!d->inSetGeometry) {
- d->inSetPos = 1;
- // Ensure setGeometry is called (avoid recursion when setPos is
- // called from within setGeometry).
- setGeometry(QRectF(pos(), size()));
- d->inSetPos = 0 ;
- }
+ d->setGeometryFromSetPos();
break;
case ItemParentChange: {
// Deliver ParentAboutToChange.
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index 50b315a..076e8626 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -879,6 +879,18 @@ void QGraphicsWidgetPrivate::resetHeight()
q->setGeometry(QRectF(q->x(), q->y(), width(), 0));
}
+void QGraphicsWidgetPrivate::setGeometryFromSetPos()
+{
+ if (inSetGeometry)
+ return;
+ Q_Q(QGraphicsWidget);
+ inSetPos = 1;
+ // Ensure setGeometry is called (avoid recursion when setPos is
+ // called from within setGeometry).
+ q->setGeometry(QRectF(pos, q->size()));
+ inSetPos = 0 ;
+}
+
QT_END_NAMESPACE
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h
index 7116a23..e9e6fc2 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.h
+++ b/src/gui/graphicsview/qgraphicswidget_p.h
@@ -139,6 +139,7 @@ public:
qreal height() const;
void setHeight(qreal);
void resetHeight();
+ void setGeometryFromSetPos();
// State
inline int attributeToBitIndex(Qt::WidgetAttribute att) const