aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/desktop-utils
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/desktop-utils')
-rw-r--r--src-qt5/desktop-utils/lumina-pdf/mainUI.cpp13
-rw-r--r--src-qt5/desktop-utils/lumina-pdf/mainUI.h6
2 files changed, 15 insertions, 4 deletions
diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
index 9e396a40..fefa6158 100644
--- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
+++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp
@@ -14,6 +14,7 @@
#include <QInputDialog>
#include <QDebug>
#include <QApplication>
+#include <QScreen>
#include <LuminaXDG.h>
@@ -25,12 +26,12 @@ MainUI::MainUI() : QMainWindow(), ui(new Ui::MainUI()){
lastdir = QDir::homePath();
Printer = new QPrinter();
- WIDGET = new QPrintPreviewWidget(Printer, this);
+ WIDGET = new QPrintPreviewWidget(Printer,this);
this->setCentralWidget(WIDGET);
connect(WIDGET, SIGNAL(paintRequested(QPrinter*)), this, SLOT(paintOnWidget(QPrinter*)) );
DOC = 0;
- PrintDLG = new QPrintDialog(Printer,this);
+ PrintDLG = new QPrintDialog(this);
connect(PrintDLG, SIGNAL(accepted(QPrinter*)), this, SLOT(paintOnWidget(QPrinter*)) ); //Can change to PaintToPrinter() later
//Create the other interface widgets
@@ -110,6 +111,7 @@ void MainUI::loadFile(QString path){
if(PAGE!=0){
lastdir = path.section("/",0,-2); //save this for later
Printer->setPageSize( QPageSize(PAGE->pageSize(), QPageSize::Point) );
+ Printer->setPageMargins(QMarginsF(0,0,0,0), QPageLayout::Point);
switch(PAGE->orientation()){
case Poppler::Page::Landscape:
Printer->setOrientation(QPrinter::Landscape); break;
@@ -137,12 +139,15 @@ void MainUI::paintOnWidget(QPrinter *PRINTER){
//Now start painting all the pages onto the widget
QRectF size = PRINTER->pageRect(QPrinter::DevicePixel);
QSize DPI(PRINTER->resolution(),PRINTER->resolution());
+ //QScreen *scrn = QApplication::screens().first();
+ //QSize SDPI(scrn->logicalDotsPerInchX(), scrn->logicalDotsPerInchY());
QPainter painter(PRINTER);
//qDebug() << "Set progress bar range:" << firstpage+1 << pages;
progress->setRange(firstpage+1,pages+1);
//progress->setValue(firstpage);
progAct->setVisible(true);
-
+ qDebug() << "Printer DPI:" << DPI;
+ //qDebug() << "Screen DPI:" << SDPI;
for(int i=firstpage; i<pages; i++){
//qDebug() << "Loading Page:" << i;
progress->setValue(i+1);
@@ -153,7 +158,7 @@ void MainUI::paintOnWidget(QPrinter *PRINTER){
if(i != firstpage){ PRINTER->newPage(); } //this is the start of the next page (not needed for first)
Poppler::Page *PAGE = DOC->page(i);
if(PAGE!=0){
- painter.drawImage(0,0,PAGE->renderToImage(DPI.width(), DPI.height()).scaled(size.width(), size.height(), Qt::KeepAspectRatio, Qt::SmoothTransformation) );
+ painter.drawImage(0,0,PAGE->renderToImage(2*DPI.width(), 2*DPI.height()).scaled(size.width(), size.height(), Qt::IgnoreAspectRatio, Qt::SmoothTransformation) );
}else{
painter.drawImage(0,0,QImage());
}
diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.h b/src-qt5/desktop-utils/lumina-pdf/mainUI.h
index d7de8485..7198b3c3 100644
--- a/src-qt5/desktop-utils/lumina-pdf/mainUI.h
+++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.h
@@ -41,11 +41,17 @@ private:
QProgressBar *progress;
QAction *progAct; //action associated with the progressbar
+
private slots:
+ //void startPainting(QPrinter *PRINTER);
void paintOnWidget(QPrinter *PRINTER);
+ //void paintPage(QPrinter *PRINTER, QImage img, bool newpage);
//Button Slots
void OpenNewFile();
+signals:
+ //void pageLoaded(QPrinter*, QImage, bool);
+
};
#endif
bgstack15