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

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

#include <DlgImportCroppingNonPdf.h>

Inheritance diagram for DlgImportCroppingNonPdf:
Inheritance graph
Collaboration diagram for DlgImportCroppingNonPdf:
Collaboration graph

Public Member Functions

 DlgImportCroppingNonPdf (const QString &fileName)
 Single constructor. More...
 
virtual ~DlgImportCroppingNonPdf ()
 
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 non-pdf file.

Definition at line 24 of file DlgImportCroppingNonPdf.h.

Constructor & Destructor Documentation

◆ DlgImportCroppingNonPdf()

DlgImportCroppingNonPdf::DlgImportCroppingNonPdf ( const QString &  fileName)

Single constructor.

Definition at line 28 of file DlgImportCroppingNonPdf.cpp.

28  :
29  m_fileName (fileName),
30  m_pixmap (nullptr),
31  m_nonPdfCropping (nullptr)
32 {
33  LOG4CPP_INFO_S ((*mainCat)) << "DlgImportCroppingNonPdf::DlgImportCroppingNonPdf";
34 
35  setWindowTitle (tr ("Image File Import Cropping"));
36  setModal (true);
37 
38  QWidget *subPanel = new QWidget ();
39  QGridLayout *layout = new QGridLayout (subPanel);
40  subPanel->setLayout (layout);
41 
42  int row = 0;
43 
44  createPreview (layout, row);
45  finishPanel (subPanel);
46  updatePreview ();
47 
48  // Bring the two middle columns together
49  layout->setColumnStretch (0, 1);
50  layout->setColumnStretch (1, 0);
51  layout->setColumnStretch (2, 0);
52  layout->setColumnStretch (3, 1);
53 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

◆ ~DlgImportCroppingNonPdf()

DlgImportCroppingNonPdf::~DlgImportCroppingNonPdf ( )
virtual

Definition at line 55 of file DlgImportCroppingNonPdf.cpp.

56 {
57  LOG4CPP_INFO_S ((*mainCat)) << "DlgImportCroppingNonPdf::~DlgImportCroppingNonPdf";
58 
59  delete m_nonPdfCropping;
60 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
log4cpp::Category * mainCat
Definition: Logger.cpp:14

Member Function Documentation

◆ image()

QImage DlgImportCroppingNonPdf::image ( ) const

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

Definition at line 133 of file DlgImportCroppingNonPdf.cpp.

134 {
135  // If the entire page was to be returned, then this method would simply return m_image. However, only the framed
136  // portion is to be returned
137  ENGAUGE_CHECK_PTR (m_nonPdfCropping);
138  QRectF rectFramePixels = m_nonPdfCropping->frameRect ();
139 
140  return m_image.copy (rectFramePixels.toRect ());
141 }
#define ENGAUGE_CHECK_PTR(ptr)
#endif
Definition: EngaugeAssert.h:27
QRectF frameRect() const
Frame rectangle selected by user.

◆ showEvent()

void DlgImportCroppingNonPdf::showEvent ( QShowEvent *  event)
virtual

Do preparation before dialog is displayed.

Definition at line 170 of file DlgImportCroppingNonPdf.cpp.

171 {
172  QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
173  settings.beginGroup (SETTINGS_GROUP_IMPORT_CROPPING);
174  if (settings.contains (SETTINGS_IMPORT_CROPPING_POS)) {
175 
176  // Restore the settings that were stored by the last call to saveGeometryToSettings
177  restoreGeometry (settings.value (SETTINGS_IMPORT_CROPPING_POS).toByteArray ());
178  }
179  settings.endGroup ();
180 }
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: