Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
What is the difference of these two sequences initializing the QPrinter?
Using QPrinterinfo directly without any dialog:
QPrinterInfo printerInfo = QPrinterInfo::printerInfo("Printer NN");
Using QPrintDialog to select the printer:
QPrintDialog dialog(&printer, this);
if (dialog.exec() != QDialog::Accepted)
When printing, I experience that method number 2 works as expected, while method number 1 is stretching the output horizontally.
In this case I would prefere to print without an extra dialog, but cannot figure out what "magic" the QPrintDialog does to my QPrinter.
@mads-l how is this topic different from https://forum.qt.io/topic/97637/qprinter-the-output-becomes-stretched ?
@jsulm I do, and it is working fine in this situation. I am using a label printer, and the size of the label is according to the properties of the setup in the printer driver. When using the QPrinterInfo with the name of the printer in the QPrinter constructor it fails.
@aha_1980 I am working with the same problem, but this is a more generalized presentation of the problem.
You can check out what QPrintDialog does via
all code is hot linked so its easy to navigate.