[Add] GUI Layout.
[Add] Integrated tableview and files.
This commit is contained in:
parent
eae4c1ee83
commit
3dfcf983ad
BIN
img/about.png
Normal file
BIN
img/about.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
img/export.png
Normal file
BIN
img/export.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
BIN
img/exportall.png
Normal file
BIN
img/exportall.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
img/hpdf.png
Normal file
BIN
img/hpdf.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
29
src/pdf_file.cpp
Normal file
29
src/pdf_file.cpp
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
#include <QtGlobal>
|
||||||
|
#include <QtWidgets>
|
||||||
|
#include "pdf_file.h"
|
||||||
|
|
||||||
|
PDFFile::PDFFile(const QString& fileName) {
|
||||||
|
/* Load PDF file. */
|
||||||
|
document = Poppler::Document::load(fileName);
|
||||||
|
if(!document || document->isLocked()) {
|
||||||
|
delete document;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage* PDFFile::getPageImage(int pageNumber) {
|
||||||
|
if(document == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
Poppler::Page* pdfPage = document->page(pageNumber);
|
||||||
|
|
||||||
|
if(pdfPage == 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
QImage* image = new QImage();
|
||||||
|
*image = pdfPage->renderToImage();
|
||||||
|
|
||||||
|
delete pdfPage;
|
||||||
|
|
||||||
|
return image;
|
||||||
|
}
|
||||||
|
|
18
src/pdf_file.h
Normal file
18
src/pdf_file.h
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QObject>
|
||||||
|
#include <poppler-qt5.h>
|
||||||
|
|
||||||
|
class QString;
|
||||||
|
class QImage;
|
||||||
|
|
||||||
|
class PDFFile : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PDFFile(const QString& fileName);
|
||||||
|
QImage* getPageImage(int pageNumber);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Poppler::Document* document;
|
||||||
|
QString fileName;
|
||||||
|
};
|
||||||
|
|
20
src/pdf_page_widget.cpp
Normal file
20
src/pdf_page_widget.cpp
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#include <QtWidgets>
|
||||||
|
#include "pdf_page_widget.h"
|
||||||
|
|
||||||
|
PDFPageWidget::PDFPageWidget(QWidget* parent) :
|
||||||
|
QWidget(parent) {
|
||||||
|
|
||||||
|
this->resize(500, 600);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PDFPageWidget::setPageImage(QImage* pageImage) {
|
||||||
|
image = pageImage;
|
||||||
|
pixmap = QPixmap::fromImage(*image);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PDFPageWidget::paintEvent(QPaintEvent* event) {
|
||||||
|
QPainter painter(this);
|
||||||
|
painter.drawPixmap(QRect(0, 0, pixmap.width(), pixmap.height()), pixmap);
|
||||||
|
}
|
||||||
|
|
21
src/pdf_page_widget.h
Normal file
21
src/pdf_page_widget.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QImage;
|
||||||
|
class QPixmap;
|
||||||
|
class QPaintEvent;
|
||||||
|
|
||||||
|
class PDFPageWidget : public QWidget {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
PDFPageWidget(QWidget* parent = 0);
|
||||||
|
void setPageImage(QImage* pageImage);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void paintEvent(QPaintEvent* event);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QImage* image;
|
||||||
|
QPixmap pixmap;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user