Print Widget on Qt Creator
-
Hi,
I want to know is there any code to use on Qt to print my widget application because i tried many solutions but no one worked with me.
And Thanks. -
Pleasse explain a little bit more what do you want exactly. For example there is a library called haruPdf that might help you to print your app as pdf but I don't know if this is what you want.
-
Thank u marstay i finally fix my problem using QPrinter and QPrinterDialog :)
here is the code :
QPrinter *printer = new QPrinter;
QPrintDialog *printDialog = new QPrintDialog(printer, this);
if (printDialog->exec() == QDialog::Accepted) {
QPainter p(printer);
QPixmap pm = QPixmap::grabWidget(this);
p.drawPixmap(0, 0, pm);
}