PDA

View Full Version : Printing from TextEdit | QPrinter | QPrintDialog



Noob
14th May 2013, 07:27
Hi,

I am trying to get printing service to work in my simple program. I am doing it in this way:



#include <QtPrintSupport/QPrintDialog>
#include <QtPrintSupport/QPrinter>

And than I get the code in my print button.


void MainWindow::on_printButton_clicked()
{
QPrinter printer;
QPrintDialog printDialog(&printer, this);
if (printDialog.exec() == QDialog::Accepted) {
ui->textBox->print(&printer);
}
}

I get a lot of "undefined reference" errors to QPrintDialog and QPrinter.
If You could drop me some hint.

ChrisW67
14th May 2013, 07:54
Your includes:


#include <QPrintDialog>
#include <QPrinter>

Your PRO file:


QT += printsupport