Engauge Digitizer 2
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
NonPdfCropping Class Reference

This class shows a frame around the selected portion of the import preview window. More...

#include <NonPdfCropping.h>

Collaboration diagram for NonPdfCropping:
Collaboration graph

Public Member Functions

 NonPdfCropping (QGraphicsScene &scene, ViewPreview &view)
 Single constructor.
 
 ~NonPdfCropping ()
 
QRectF frameRect () const
 Frame rectangle selected by user.
 
void moveBL (const QPointF &newPos, const QPointF &oldPos)
 Bottom left corner handle was moved.
 
void moveBR (const QPointF &newPos, const QPointF &oldPos)
 Bottom right corner handle was moved.
 
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.
 
QSize windowSize () const
 Size of window in scene coordinates.
 

Static Public Attributes

static const int NON_PDF_CROPPING_BOTTOM = 1
 Bit flag when handle is aligned with bottom edge at reference point.
 
static const int NON_PDF_CROPPING_LEFT = 2
 Bit flag when handle is aligned with left edge at reference point.
 
static const int NON_PDF_CROPPING_RIGHT = 4
 Bit flag when handle is aligned with right edge at reference point.
 
static const int NON_PDF_CROPPING_TOP = 8
 Bit flag when handle is aligned with top edge at reference point.
 

Detailed Description

This class shows a frame around the selected portion of the import preview window.

This class was developed as a non-pdf equivalent to the PdfCropping class. See that class for more details

Definition at line 22 of file NonPdfCropping.h.

Constructor & Destructor Documentation

◆ NonPdfCropping()

NonPdfCropping::NonPdfCropping ( QGraphicsScene & scene,
ViewPreview & view )

Single constructor.

Definition at line 20 of file NonPdfCropping.cpp.

21 :
22 m_view (view),
23 m_handleTL (nullptr),
24 m_handleTR (nullptr),
25 m_handleBR (nullptr),
26 m_handleBL (nullptr)
27{
28 createWidgets (scene);
29}

◆ ~NonPdfCropping()

NonPdfCropping::~NonPdfCropping ( )

Definition at line 31 of file NonPdfCropping.cpp.

32{
33 delete m_handleTL;
34 delete m_handleTR;
35 delete m_handleBR;
36 delete m_handleBL;
37}

Member Function Documentation

◆ frameRect()

QRectF NonPdfCropping::frameRect ( ) const

Frame rectangle selected by user.

Definition at line 81 of file NonPdfCropping.cpp.

82{
83 // The x(), y(), pos(), rect() and boundingRect() will return coordinates assuming origin at the initial position of
84 // each handle. So to get the coordinates in the window reference frame it takes a two step process like
85 // QGraphicsRectItem::mapRectToScene (QGraphicsRectItem::rect())
86
87 QRectF rectTL = m_handleTL->mapRectToScene (m_handleTL->boundingRect());
88 QRectF rectBR = m_handleBR->mapRectToScene (m_handleBR->boundingRect());
89
90 QRectF rectUnited = rectTL.united (rectBR);
91
92 return rectUnited;
93}
const int INNER_RADIUS_MIN

◆ moveBL()

void NonPdfCropping::moveBL ( const QPointF & newPos,
const QPointF & oldPos )

Bottom left corner handle was moved.

Definition at line 95 of file NonPdfCropping.cpp.

97{
98 disableEventsWhileMovingAutomatically();
99
100 double deltaX = newPos.x() - oldPos.x();
101 double deltaY = newPos.y() - oldPos.y();
102
103 m_handleTL->moveBy (deltaX,
104 0);
105 m_handleBR->moveBy (0,
106 deltaY);
107
108 enableEventsWhileMovingAutomatically();
109
110 updateBox();
111}

◆ moveBR()

void NonPdfCropping::moveBR ( const QPointF & newPos,
const QPointF & oldPos )

Bottom right corner handle was moved.

Definition at line 113 of file NonPdfCropping.cpp.

115{
116 disableEventsWhileMovingAutomatically();
117
118 double deltaX = newPos.x() - oldPos.x();
119 double deltaY = newPos.y() - oldPos.y();
120
121 m_handleBL->moveBy (0,
122 deltaY);
123 m_handleTR->moveBy (deltaX,
124 0);
125
126 enableEventsWhileMovingAutomatically();
127
128 updateBox();
129}

◆ moveTL()

void NonPdfCropping::moveTL ( const QPointF & newPos,
const QPointF & oldPos )

Top left corner handle was moved.

Definition at line 131 of file NonPdfCropping.cpp.

133{
134 disableEventsWhileMovingAutomatically();
135
136 double deltaX = newPos.x() - oldPos.x();
137 double deltaY = newPos.y() - oldPos.y();
138
139 m_handleBL->moveBy (deltaX,
140 0);
141 m_handleTR->moveBy (0,
142 deltaY);
143
144 enableEventsWhileMovingAutomatically();
145
146 updateBox();
147}

◆ moveTR()

void NonPdfCropping::moveTR ( const QPointF & newPos,
const QPointF & oldPos )

Top right corner handle was moved.

Definition at line 149 of file NonPdfCropping.cpp.

151{
152 disableEventsWhileMovingAutomatically();
153
154 double deltaX = newPos.x() - oldPos.x();
155 double deltaY = newPos.y() - oldPos.y();
156
157 m_handleTL->moveBy (0,
158 deltaY);
159 m_handleBR->moveBy (deltaX,
160 0);
161
162 enableEventsWhileMovingAutomatically();
163
164 updateBox();
165}

◆ windowSize()

QSize NonPdfCropping::windowSize ( ) const

Size of window in scene coordinates.

Definition at line 178 of file NonPdfCropping.cpp.

179{
180 return QSize (qFloor (m_view.scene()->width()),
181 qFloor (m_view.scene()->height()));
182}

Member Data Documentation

◆ NON_PDF_CROPPING_BOTTOM

const int NonPdfCropping::NON_PDF_CROPPING_BOTTOM = 1
static

Bit flag when handle is aligned with bottom edge at reference point.

Definition at line 49 of file NonPdfCropping.h.

◆ NON_PDF_CROPPING_LEFT

const int NonPdfCropping::NON_PDF_CROPPING_LEFT = 2
static

Bit flag when handle is aligned with left edge at reference point.

Definition at line 50 of file NonPdfCropping.h.

◆ NON_PDF_CROPPING_RIGHT

const int NonPdfCropping::NON_PDF_CROPPING_RIGHT = 4
static

Bit flag when handle is aligned with right edge at reference point.

Definition at line 51 of file NonPdfCropping.h.

◆ NON_PDF_CROPPING_TOP

const int NonPdfCropping::NON_PDF_CROPPING_TOP = 8
static

Bit flag when handle is aligned with top edge at reference point.

Definition at line 52 of file NonPdfCropping.h.


The documentation for this class was generated from the following files: