10#include <QGraphicsRectItem>
11#include <QGraphicsScene>
28 createWidgets (scene);
39void NonPdfCropping::createWidgets(QGraphicsScene &scene)
57 m_box =
new QGraphicsRectItem;
58 m_box->setZValue (
Z_BOX);
60 scene.addItem (m_box);
65void NonPdfCropping::disableEventsWhileMovingAutomatically ()
73void NonPdfCropping::enableEventsWhileMovingAutomatically ()
87 QRectF rectTL = m_handleTL->mapRectToScene (m_handleTL->boundingRect());
88 QRectF rectBR = m_handleBR->mapRectToScene (m_handleBR->boundingRect());
98 disableEventsWhileMovingAutomatically();
103 m_handleTL->moveBy (
deltaX,
105 m_handleBR->moveBy (0,
108 enableEventsWhileMovingAutomatically();
116 disableEventsWhileMovingAutomatically();
121 m_handleBL->moveBy (0,
123 m_handleTR->moveBy (
deltaX,
126 enableEventsWhileMovingAutomatically();
134 disableEventsWhileMovingAutomatically();
139 m_handleBL->moveBy (
deltaX,
141 m_handleTR->moveBy (0,
144 enableEventsWhileMovingAutomatically();
152 disableEventsWhileMovingAutomatically();
157 m_handleTL->moveBy (0,
159 m_handleBR->moveBy (
deltaX,
162 enableEventsWhileMovingAutomatically();
167void NonPdfCropping::updateBox ()
181 qFloor (m_view.scene()->height()));
const int INNER_RADIUS_MIN
void moveBL(const QPointF &newPos, const QPointF &oldPos)
Bottom left corner handle was moved.
static const int NON_PDF_CROPPING_BOTTOM
Bit flag when handle is aligned with bottom edge at reference point.
void moveBR(const QPointF &newPos, const QPointF &oldPos)
Bottom right corner handle was moved.
QSize windowSize() const
Size of window in scene coordinates.
static const int NON_PDF_CROPPING_RIGHT
Bit flag when handle is aligned with right edge at reference point.
QRectF frameRect() const
Frame rectangle selected by user.
void moveTR(const QPointF &newPos, const QPointF &oldPos)
Top right corner handle was moved.
static const int NON_PDF_CROPPING_LEFT
Bit flag when handle is aligned with left edge at reference point.
void moveTL(const QPointF &newPos, const QPointF &oldPos)
Top left corner handle was moved.
NonPdfCropping(QGraphicsScene &scene, ViewPreview &view)
Single constructor.
static const int NON_PDF_CROPPING_TOP
Bit flag when handle is aligned with top edge at reference point.
This class acts as a single handle for the NonPdfCropping class.
void setDisableEventsWhileMovingAutomatically(bool disable)
Temporarily disable event handling so code can move this object without triggering a cascade of event...
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window,...