Engauge Digitizer  2
Public Member Functions | List of all members
DlgImportCroppingPdf Class Reference

Dialog for selecting a page and frame on that page when importing an image from a pdf file. More...

#include <DlgImportCroppingPdf.h>

Inheritance diagram for DlgImportCroppingPdf:
Inheritance graph
Collaboration diagram for DlgImportCroppingPdf:
Collaboration graph

Public Member Functions

 DlgImportCroppingPdf (const Poppler::Document &document, int resolution)
 Single constructor. More...
 
virtual ~DlgImportCroppingPdf ()
 
QImage image () const
 Image that was selected. Value is null if loading failed. More...
 
virtual void showEvent (QShowEvent *event)
 Do preparation before dialog is displayed. More...
 

Detailed Description

Dialog for selecting a page and frame on that page when importing an image from a pdf file.

Definition at line 28 of file DlgImportCroppingPdf.h.

Constructor & Destructor Documentation

◆ DlgImportCroppingPdf()

DlgImportCroppingPdf::DlgImportCroppingPdf ( const Poppler::Document &  document,
int  resolution 
)

Single constructor.

Definition at line 36 of file DlgImportCroppingPdf.cpp.

37  :
38  m_document (document),
39  m_resolution (resolution),
40  m_pixmap (nullptr)
41 {
42  LOG4CPP_INFO_S ((*mainCat)) << "DlgImportCroppingPdf::DlgImportCroppingPdf";
43 
44  setWindowTitle (tr ("PDF File Import Cropping"));
45  setModal (true);
46 
47  QWidget *subPanel = new QWidget ();
48  QGridLayout *layout = new QGridLayout (subPanel);
49  subPanel->setLayout (layout);
50 
51  int row = 0;
52 
53  createTimer ();
54  createPageSpinner (layout, row);
55  createPreview (layout, row);
56  finishPanel (subPanel);
57  updatePreview ();
58 
59  // Bring the two middle columns together
60  layout->setColumnStretch (0, 1);
61  layout->setColumnStretch (1, 0);
62  layout->setColumnStretch (2, 0);
63  layout->setColumnStretch (3, 1);
64 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ ~DlgImportCroppingPdf()

DlgImportCroppingPdf::~DlgImportCroppingPdf ( )
virtual

Definition at line 66 of file DlgImportCroppingPdf.cpp.

67 {
68  LOG4CPP_INFO_S ((*mainCat)) << "DlgImportCroppingPdf::~DlgImportCroppingPdf";
69 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

Member Function Documentation

◆ image()

QImage DlgImportCroppingPdf::image ( ) const

Image that was selected. Value is null if loading failed.

Definition at line 167 of file DlgImportCroppingPdf.cpp.

168 {
169  // If the entire page was to be returned, then this method would simply return m_image. However, only the framed
170  // portion is to be returned
171  ENGAUGE_ASSERT (m_pdfCropping != nullptr);
172  QRectF rectFramePixels = m_pdfCropping->frameRect ();
173 
174  return m_image.copy (rectFramePixels.toRect ());
175 }
QRectF frameRect() const
Frame rectangle selected by user.
Definition: PdfCropping.cpp:69
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
Definition: EngaugeAssert.h:20

◆ showEvent()

void DlgImportCroppingPdf::showEvent ( QShowEvent *  event)
virtual

Do preparation before dialog is displayed.

Definition at line 217 of file DlgImportCroppingPdf.cpp.

218 {
219  QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
220  settings.beginGroup (SETTINGS_GROUP_IMPORT_CROPPING);
221  if (settings.contains (SETTINGS_IMPORT_CROPPING_POS)) {
222 
223  // Restore the settings that were stored by the last call to saveGeometryToSettings
224  restoreGeometry (settings.value (SETTINGS_IMPORT_CROPPING_POS).toByteArray ());
225  }
226  settings.endGroup ();
227 }
const QString SETTINGS_GROUP_IMPORT_CROPPING
const QString SETTINGS_DIGITIZER
const QString SETTINGS_ENGAUGE
const QString SETTINGS_IMPORT_CROPPING_POS

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