10#include <QGraphicsRectItem>
11#include <QGraphicsScene>
24 createWidgets (scene);
27void PdfCropping::createWidgets(QGraphicsScene &scene)
45 m_box =
new QGraphicsRectItem;
46 m_box->setZValue (
Z_BOX);
48 scene.addItem (m_box);
53void PdfCropping::disableEventsWhileMovingAutomatically ()
61void PdfCropping::enableEventsWhileMovingAutomatically ()
75 QRectF rectTL = m_handleTL->mapRectToScene (m_handleTL->boundingRect());
76 QRectF rectBR = m_handleBR->mapRectToScene (m_handleBR->boundingRect());
86 disableEventsWhileMovingAutomatically();
91 m_handleTL->moveBy (
deltaX,
93 m_handleBR->moveBy (0,
96 enableEventsWhileMovingAutomatically();
104 disableEventsWhileMovingAutomatically();
109 m_handleBL->moveBy (0,
111 m_handleTR->moveBy (
deltaX,
114 enableEventsWhileMovingAutomatically();
122 disableEventsWhileMovingAutomatically();
127 m_handleBL->moveBy (
deltaX,
129 m_handleTR->moveBy (0,
132 enableEventsWhileMovingAutomatically();
140 disableEventsWhileMovingAutomatically();
145 m_handleTL->moveBy (0,
147 m_handleBR->moveBy (
deltaX,
150 enableEventsWhileMovingAutomatically();
155void PdfCropping::updateBox ()
169 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 PDF_CROPPING_LEFT
Bit flag when handle is aligned with left edge at reference point.
PdfCropping(QGraphicsScene &scene, ViewPreview &view)
Single constructor.
static const int PDF_CROPPING_BOTTOM
Bit flag when handle is aligned with bottom edge at reference point.
QSize windowSize() const
Size of window in scene coordinates.
static const int PDF_CROPPING_TOP
Bit flag when handle is aligned with top edge at reference point.
void moveTL(const QPointF &newPos, const QPointF &oldPos)
Top left corner handle was moved.
void moveTR(const QPointF &newPos, const QPointF &oldPos)
Top right corner handle was moved.
void moveBR(const QPointF &newPos, const QPointF &oldPos)
Bottom right corner handle was moved.
QRectF frameRect() const
Frame rectangle selected by user.
static const int PDF_CROPPING_RIGHT
Bit flag when handle is aligned with right edge at reference point.
This class acts as a single handle for the PdfCropping 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,...