SANKORE-276 add max ruler size = 700sm

preferencesAboutTextFull
Anatoly Mihalchenko 13 years ago
parent 519b3db0d6
commit f3cec81b51
  1. 4
      src/tools/UBGraphicsRuler.cpp
  2. 3
      src/tools/UBGraphicsRuler.h

@ -323,6 +323,10 @@ void UBGraphicsRuler::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
QPointF delta = event->pos() - event->lastPos(); QPointF delta = event->pos() - event->lastPos();
if (rect().width() + delta.x() < sMinLength) if (rect().width() + delta.x() < sMinLength)
delta.setX(sMinLength - rect().width()); 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()))); setRect(QRectF(rect().topLeft(), QSizeF(rect().width() + delta.x(), rect().height())));
} }
else else

@ -90,7 +90,8 @@ class UBGraphicsRuler : public UBAbstractDrawRuler, public QGraphicsRectItem, pu
// Constants // Constants
static const QRect sDefaultRect; static const QRect sDefaultRect;
static const int sMinLength = 150; static const int sMinLength = 150; // 3sm
static const int sMaxLength = 35000; // 700sm
}; };
#endif /* UBGRAPHICSRULER_H_ */ #endif /* UBGRAPHICSRULER_H_ */

Loading…
Cancel
Save