Engauge Digitizer  2
NonPdfCropping.h
Go to the documentation of this file.
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef NON_PDF_CROPPING_H
8 #define NON_PDF_CROPPING_H
9 
10 #include <QRect>
11 #include <QSize>
12 
13 class NonPdfFrameHandle;
14 class QGraphicsRectItem;
15 class QGraphicsScene;
16 class QPointF;
17 class ViewPreview;
18 
23 {
24 public:
26  NonPdfCropping(QGraphicsScene &scene,
27  ViewPreview &view);
29 
31  QRectF frameRect () const;
32 
34  void moveBL (const QPointF &newPos,
35  const QPointF &oldPos);
36 
38  void moveBR (const QPointF &newPos,
39  const QPointF &oldPos);
40 
42  void moveTL (const QPointF &newPos,
43  const QPointF &oldPos);
44 
46  void moveTR (const QPointF &newPos,
47  const QPointF &oldPos);
48 
49  static const int NON_PDF_CROPPING_BOTTOM = 1;
50  static const int NON_PDF_CROPPING_LEFT = 2;
51  static const int NON_PDF_CROPPING_RIGHT = 4;
52  static const int NON_PDF_CROPPING_TOP = 8;
53 
55  QSize windowSize () const;
56 
57 private:
58  NonPdfCropping ();
59 
60  void createWidgets (QGraphicsScene &scene);
61  void disableEventsWhileMovingAutomatically();
62  void enableEventsWhileMovingAutomatically();
63  QRectF rectFromTLAndBR () const;
64  void updateBox();
65 
66  ViewPreview &m_view;
67 
68  // Box
69  QGraphicsRectItem *m_box;
70 
71  // Handles
72  NonPdfFrameHandle *m_handleTL;
73  NonPdfFrameHandle *m_handleTR;
74  NonPdfFrameHandle *m_handleBR;
75  NonPdfFrameHandle *m_handleBL;
76 
77 };
78 
79 #endif // NON_PDF_CROPPING_H
static const int NON_PDF_CROPPING_LEFT
Bit flag when handle is aligned with left edge at reference point.
This class shows a frame around the selected portion of the import preview window.
void moveTL(const QPointF &newPos, const QPointF &oldPos)
Top left corner handle was moved.
QSize windowSize() const
Size of window in scene coordinates.
static const int NON_PDF_CROPPING_TOP
Bit flag when handle is aligned with top edge at reference point.
static const int NON_PDF_CROPPING_BOTTOM
Bit flag when handle is aligned with bottom edge at reference point.
void moveTR(const QPointF &newPos, const QPointF &oldPos)
Top right corner handle was moved.
QRectF frameRect() const
Frame rectangle selected by user.
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window,...
Definition: ViewPreview.h:14
This class acts as a single handle for the NonPdfCropping class.
void moveBR(const QPointF &newPos, const QPointF &oldPos)
Bottom right corner handle was moved.
void moveBL(const QPointF &newPos, const QPointF &oldPos)
Bottom left corner handle was moved.
static const int NON_PDF_CROPPING_RIGHT
Bit flag when handle is aligned with right edge at reference point.