Set printer resolution

You need a better resolution to plot a picture with high resolution...

Connection done with a lambda expression thanks to @dirkhh.

Signed-off-by: Robert C. Helling <helling@atdotde.de> (+1 squashed commit)
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2020-08-22 14:36:41 +02:00 committed by Dirk Hohndel
parent 02a4aa927e
commit 8f6d054140
4 changed files with 35 additions and 1 deletions

View file

@ -171,6 +171,7 @@ void PrintDialog::createPrinterObj()
// create a new printer object
if (!printer) {
qprinter = new QPrinter();
qprinter->setResolution(printOptions.resolution);
qprinter->setOrientation((QPrinter::Orientation)printOptions.landscape);
printer = new Printer(qprinter, &printOptions, &templateOptions, Printer::PRINT);
}

View file

@ -44,7 +44,9 @@ void PrintOptions::setup()
connect(ui.printInColor, SIGNAL(clicked(bool)), this, SLOT(printInColorClicked(bool)));
connect(ui.printSelected, SIGNAL(clicked(bool)), this, SLOT(printSelectedClicked(bool)));
connect(ui.resolution, QOverload<int>::of(&QSpinBox::valueChanged), [this](int value) {
printOptions->resolution = value;
});
hasSetupSlots = true;
}

View file

@ -15,6 +15,7 @@ struct print_options {
bool print_selected;
bool color_selected;
bool landscape;
int resolution;
};
struct template_options {

View file

@ -93,6 +93,36 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QSpinBox" name="resolution">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximum">
<number>4000</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>600</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>DPI resolution</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>