Problem with printing
I am trying to print a QTableWidget with QPrinter. When I add #include <QPrinter> the compiler complains that this header does not exist. I found a QPrinter header in <QtPrintSupport/QPrinter> but if I use that then the linker complains "Symbol not found for architecture x86_64. I am using MacBook pro and I also installed the full package of QT. Here is the piece of code I am trying to use (It is completely from documentation with little change)
@ QPainter painter;
double xscale = printer.pageRect().width()/double(ui->tableStatics->width());
double yscale = printer.pageRect().height()/double(ui->tableStatics->height());
double scale = qMin(xscale, yscale);
painter.translate(printer.paperRect().x() + printer.pageRect().width()/2,
printer.paperRect().y() + printer.pageRect().height()/2);
Any help is appreciated.
tzander last edited by
In Qt5 the printing module is separated.
QT += printsupport
Could you please give more details or an example
Fear last edited by
Add the "QT += printsupport" to your .pro file.
Also to make the code correct for later reference, at the end a