comparison src/printing.cpp @ 166:9511e2f250be

Force default page margins for printing, this fixes some problems under Windows.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 19 Sep 2017 13:01:29 +0300
parents 186d0717707f
children c54ad71c1205
comparison
equal deleted inserted replaced
165:186d0717707f 166:9511e2f250be
16 16
17 void SyntilistaMainWindow::on_button_Print_clicked() 17 void SyntilistaMainWindow::on_button_Print_clicked()
18 { 18 {
19 // Create a printer object and force some basic settings 19 // Create a printer object and force some basic settings
20 QPrinter printer(QPrinter::HighResolution); 20 QPrinter printer(QPrinter::HighResolution);
21 printer.setResolution(300);
21 printer.setPageSize(QPageSize(QPageSize::A4)); 22 printer.setPageSize(QPageSize(QPageSize::A4));
23 printer.setPageMargins(QMarginsF(0.25f, 0.5f, 0.25f, 0.5f), QPageLayout::Inch);
22 printer.setColorMode(QPrinter::GrayScale); 24 printer.setColorMode(QPrinter::GrayScale);
23 printer.setResolution(300);
24 25
25 // We need to get the page count here, and also need it again in 26 // We need to get the page count here, and also need it again in
26 // printDocument(), but there is no sane way to pass that there, 27 // printDocument(), but there is no sane way to pass that there,
27 // so some code duplication is unfortunately necessary 28 // so some code duplication is unfortunately necessary
28 pinfo.npages = 0; 29 pinfo.npages = 0;