How can i print all the content of groupbox in any available printers?
-
This is an image of the missing part which i wish to include in the printing.
this is my output which shows it was cut
this is the the code:
QPrinter printer; QPainter painter; Dialog w; QPrintDialog printDialog(&printer); if (printDialog.exec() == QDialog::Accepted) { painter.begin(&printer); printer.setPaperSize(QPrinter::A4); printer.setPageMargins(2, 2, 2, 10, QPrinter::Millimeter); printer.setFullPage(true); double xscale = printer.pageRect().width() / double(w.width()); double yscale = printer.pageRect().height() / double(w.height()); double scale = qMin(xscale, yscale); painter.translate(printer.paperRect().center()); painter.scale(scale, scale); painter.translate(-w.width()/ 2, -w.height()/ 2); ui->groupBox->render(&painter); }
-
This is an image of the missing part which i wish to include in the printing.
this is my output which shows it was cut
this is the the code:
QPrinter printer; QPainter painter; Dialog w; QPrintDialog printDialog(&printer); if (printDialog.exec() == QDialog::Accepted) { painter.begin(&printer); printer.setPaperSize(QPrinter::A4); printer.setPageMargins(2, 2, 2, 10, QPrinter::Millimeter); printer.setFullPage(true); double xscale = printer.pageRect().width() / double(w.width()); double yscale = printer.pageRect().height() / double(w.height()); double scale = qMin(xscale, yscale); painter.translate(printer.paperRect().center()); painter.scale(scale, scale); painter.translate(-w.width()/ 2, -w.height()/ 2); ui->groupBox->render(&painter); }
@ioanna Just use QPrinter returned by https://doc.qt.io/qt-5/qprintdialog.html#printer
-
It's the same the output is still like this.
https://drive.google.com/file/d/1WIe7IHVREm-9FTrBl5WAqZ3g-MgjaSj-/view?usp=sharing
-
It's the same the output is still like this.
https://drive.google.com/file/d/1WIe7IHVREm-9FTrBl5WAqZ3g-MgjaSj-/view?usp=sharing
-
-
@jsulm sir i have the same result, i forgot to tell you that during run time the ui was also cut exactly the same with the one being printed. I can't find a way to display what i have designed in my UI form since it is too long with a height of 1.3k.
@ioanna It looks like you did not put all your widgets in a layout. Do this first. https://doc.qt.io/qt-5/layout.html