diff --git a/src/domain/UBGraphicsStrokesGroup.cpp b/src/domain/UBGraphicsStrokesGroup.cpp index 11b43fc9..0ab954f2 100644 --- a/src/domain/UBGraphicsStrokesGroup.cpp +++ b/src/domain/UBGraphicsStrokesGroup.cpp @@ -49,8 +49,7 @@ UBGraphicsStrokesGroup::UBGraphicsStrokesGroup(QGraphicsItem *parent) setFlag(QGraphicsItem::ItemIsMovable, true); mDebugText = NULL; - - + debugTextEnabled = false; // set to true to get a graphical display of strokes' Z-levels } UBGraphicsStrokesGroup::~UBGraphicsStrokesGroup() @@ -206,7 +205,7 @@ void UBGraphicsStrokesGroup::paint(QPainter *painter, const QStyleOptionGraphics QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVariant &value) { - if (change == ItemZValueChange) { + if (debugTextEnabled && change == ItemZValueChange) { double newZ = qvariant_cast(value); UBGraphicsPolygonItem * poly = NULL; @@ -216,14 +215,13 @@ QVariant UBGraphicsStrokesGroup::itemChange(GraphicsItemChange change, const QVa if (poly) { if (!mDebugText) { mDebugText = new QGraphicsSimpleTextItem("None", this); - //mDebugText->setPos(poly->scenePos()); mDebugText->setPos(poly->boundingRect().topLeft() + QPointF(10, 10)); mDebugText->setBrush(QBrush(poly->color())); } mDebugText->setText(QString("Z: %1").arg(newZ)); } - } + QVariant newValue = Delegate()->itemChange(change, value); return QGraphicsItemGroup::itemChange(change, newValue); } diff --git a/src/domain/UBGraphicsStrokesGroup.h b/src/domain/UBGraphicsStrokesGroup.h index c2182187..1d249d0c 100644 --- a/src/domain/UBGraphicsStrokesGroup.h +++ b/src/domain/UBGraphicsStrokesGroup.h @@ -67,6 +67,8 @@ protected: virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); virtual QVariant itemChange(GraphicsItemChange change, const QVariant &value); + // Graphical display of stroke Z-level + bool debugTextEnabled; QGraphicsSimpleTextItem * mDebugText; };