From 76dff66e70d75bb7c6160d5c32f0cbbd7d5e5aee Mon Sep 17 00:00:00 2001 From: Martin_Iden Date: Mon, 17 Sep 2018 15:07:47 +0300 Subject: [PATCH] Fixed double-sided printing --- mainwindow.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 3f86697..ea86670 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -487,9 +487,8 @@ void MainWindow::printAllSheets() { //i.e. while printing all sheets renderNextSheet(); - if (printer.fromPage() != 0 && printer.fromPage() > currentSheetNumber + 1) - continue; - if (printer.toPage() != 0 && printer.toPage() < currentSheetNumber + 1) + if ((printer.fromPage() != 0 && printer.fromPage() > currentSheetNumber + 1) //we're not going out of page range + || (printer.toPage() != 0 && printer.toPage() < currentSheetNumber + 1)) //defined by user continue; QImage image = ui->svgView->saveRenderToImage(); @@ -499,11 +498,9 @@ void MainWindow::printAllSheets() painter.drawImage(0, 0, image); - if (ui->toolBar->actions()[ToolButton::Next]->isEnabled() //if "Next Sheet" tool button is enabled, - && (printer.toPage() != 0 //i.e this sheet is not the last, - && currentSheetNumber + 1 < printer.toPage())) //and we're not going out of page range - printer.newPage(); //defined by user - } + if (ui->toolBar->actions()[ToolButton::Next]->isEnabled()) //if "Next Sheet" tool button is enabled, + printer.newPage(); //i.e this sheet is not the last, + } painter.end(); ui->svgView->hideBorders(false); @@ -554,6 +551,7 @@ void MainWindow::preparePrinter(QPrinter *printer) printer->setPaperSize(paperSize, QPrinter::Millimeter); printer->setResolution(settings.value("dpi", 300).toInt()); printer->setOrientation(isPortrait ? QPrinter::Portrait : QPrinter::Landscape); + printer->setDoubleSidedPrinting(true); settings.endGroup(); }