From f3cec81b51134ab5794ed6c4be73ee5a8ce2426d Mon Sep 17 00:00:00 2001 From: Anatoly Mihalchenko Date: Wed, 28 Sep 2011 16:56:52 +0300 Subject: [PATCH] SANKORE-276 add max ruler size = 700sm --- src/tools/UBGraphicsRuler.cpp | 4 ++++ src/tools/UBGraphicsRuler.h | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/tools/UBGraphicsRuler.cpp b/src/tools/UBGraphicsRuler.cpp index 046e229b..cd15de78 100644 --- a/src/tools/UBGraphicsRuler.cpp +++ b/src/tools/UBGraphicsRuler.cpp @@ -323,6 +323,10 @@ void UBGraphicsRuler::mouseMoveEvent(QGraphicsSceneMouseEvent *event) QPointF delta = event->pos() - event->lastPos(); if (rect().width() + delta.x() < sMinLength) delta.setX(sMinLength - rect().width()); + + if (rect().width() + delta.x() > sMaxLength) + delta.setX(sMaxLength - rect().width()); + setRect(QRectF(rect().topLeft(), QSizeF(rect().width() + delta.x(), rect().height()))); } else diff --git a/src/tools/UBGraphicsRuler.h b/src/tools/UBGraphicsRuler.h index d3beca82..fb74dd9d 100644 --- a/src/tools/UBGraphicsRuler.h +++ b/src/tools/UBGraphicsRuler.h @@ -90,7 +90,8 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu // Constants static const QRect sDefaultRect; - static const int sMinLength = 150; + static const int sMinLength = 150; // 3sm + static const int sMaxLength = 35000; // 700sm }; #endif /* UBGRAPHICSRULER_H_ */