From e1dae8c03e02869f752ca6210ea276e32545f11a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 13 Mar 2018 10:30:37 -0400 Subject: Cleanup the printing stuff for Qt 5.9+. Qt now handles a lot of the flags (such as copies, collation) internally now so we don't need to manually handle those anymore. --- src-qt5/desktop-utils/lumina-pdf/mainUI.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src-qt5/desktop-utils/lumina-pdf/mainUI.cpp') diff --git a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp index 54b281dd..4d255f64 100644 --- a/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp +++ b/src-qt5/desktop-utils/lumina-pdf/mainUI.cpp @@ -424,6 +424,7 @@ void MainUI::paintToPrinter(QPrinter *PRINTER){ int firstpage = 0; int copies = PRINTER->copyCount(); bool collate = PRINTER->collateCopies(); + bool reverse = (PRINTER->pageOrder()==QPrinter::LastPageFirst); qDebug() << "PRINTER DPI:" << PRINTER->resolution() << PRINTER->supportedResolutions(); //return; if(PRINTER->resolution() < 300){ @@ -438,29 +439,35 @@ void MainUI::paintToPrinter(QPrinter *PRINTER){ firstpage = PRINTER->fromPage() - 1; pages = PRINTER->toPage(); } - qDebug() << "Start Printing PDF: Pages" << PRINTER->fromPage() <<" to "<< PRINTER->toPage()<< " Copies:" << copies << " collate:" << collate; + qDebug() << "Start Printing PDF: Pages" << PRINTER->fromPage() <<" to "<< PRINTER->toPage()<< " Copies:" << copies << " collate:" << collate << " Reverse Order:" << reverse; QList pageCount; //Assemble the page order/count based on printer settings for(int i=firstpage; ipageOrder()==QPrinter::LastPageFirst){ + + //QT 5.9+ : Do not need to manually reverse the pages (already handled internally) + if(reverse){ //Need to reverse the order of the list QList tmp = pageCount; pageCount.clear(); for(int i=tmp.length()-1; i>=0; i--){ pageCount << tmp[i]; } //qDebug() << " - reversed:" << pageCount; } - if(collate && copies>0){ + + //QT 5.9+ : Do not need to manually stack "copies". Already handled internally + /*if(collate && copies>0){ QList orig = pageCount; //original array of pages for(int c=1; cpageRect().width(), PRINTER->pageRect().height()); @@ -480,6 +487,7 @@ void MainUI::paintToPrinter(QPrinter *PRINTER){ progress->setRange(0, pageCount.length()-1); for(int i=0; inewPage(); } + //qDebug() << "Printing Page:" << pageCount[i]; progress->setValue(i); QApplication::processEvents(); QImage img = loadingHash[pageCount[i]].scaled(sz, Qt::KeepAspectRatio, Qt::SmoothTransformation); -- cgit