comparison 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
comparison
equal deleted inserted replaced
401:c3276f8998ee 402:75003687f364
45 ChangesetDetailItem::boundingRect() const 45 ChangesetDetailItem::boundingRect() const
46 { 46 {
47 int w = 350; 47 int w = 350;
48 m_doc->setTextWidth(w); 48 m_doc->setTextWidth(w);
49 return QRectF(-10, -10, w + 10, m_doc->size().height() + 10); 49 return QRectF(-10, -10, w + 10, m_doc->size().height() + 10);
50 }
51
52 QVariant
53 ChangesetDetailItem::itemChange(GraphicsItemChange c, const QVariant &v)
54 {
55 if (c == ItemVisibleHasChanged) {
56 bool visible = v.toBool();
57 DEBUG << "ChangesetDetailItem::itemChange: visible = " << visible << endl;
58 if (visible && scene()) {
59 ensureVisible();
60 }
61 }
62 return v;
50 } 63 }
51 64
52 void 65 void
53 ChangesetDetailItem::paint(QPainter *paint, 66 ChangesetDetailItem::paint(QPainter *paint,
54 const QStyleOptionGraphicsItem *option, 67 const QStyleOptionGraphicsItem *option,