diff src/changesetdetailitem.cpp @ 402:75003687f364

Better version of ensuring the scene size is properly updated and the detail item made visible
author Chris Cannam
date Wed, 25 May 2011 16:05:40 +0100
parents 7ef46fb73b48
children 533519ebc0cb
line wrap: on
line diff
--- a/src/changesetdetailitem.cpp	Wed May 25 15:38:48 2011 +0100
+++ b/src/changesetdetailitem.cpp	Wed May 25 16:05:40 2011 +0100
@@ -49,6 +49,19 @@
     return QRectF(-10, -10, w + 10, m_doc->size().height() + 10);
 }
 
+QVariant
+ChangesetDetailItem::itemChange(GraphicsItemChange c, const QVariant &v)
+{
+    if (c == ItemVisibleHasChanged) {
+        bool visible = v.toBool();
+        DEBUG << "ChangesetDetailItem::itemChange: visible = " << visible << endl;
+        if (visible && scene()) {
+            ensureVisible();
+        }
+    }
+    return v;
+}
+
 void
 ChangesetDetailItem::paint(QPainter *paint,
 			   const QStyleOptionGraphicsItem *option,