Hi
it seems you made print in MainWindow::print
it should be in
TestPrint::print( QPrinter* printer )
That is why is says "print not declared in this scope" as
u seem to have pasted the code below it ?
That is ok. just correct code ( get rid of print call)
so first error is that you have no print function.
next error is that you miss the last argument for the text.
so yes, you are close to printing :)
if ( dialog.exec() == QDialog::Accepted )
{
// create painter for drawing print page
QPainter painter( &printer );
int w = printer.pageRect().width();
int h = printer.pageRect().height();
QRect page( 0, 0, w, h );
// create a font appropriate to page size
QFont font = painter.font();
font.setPixelSize( (w+h) / 100 );
painter.setFont( font );
// draw labels in corners of page
painter.drawText( page, Qt::AlignTop | Qt::AlignLeft, "QSimulate" );
painter.drawText( page, Qt::AlignBottom | Qt::AlignLeft, QString(getenv("USER")) );
//painter.drawText( page, Qt::AlignBottom | Qt::AlignRight,
// QDateTime::currentDateTime().toString( Qt::DefaultLocaleShortDate ) );
// draw simulated landscape
page.adjust( w/20, h/20, -w/20, -h/20 );
painter.drawText( &painter, page ); //testprint.cpp:78: error: no matching function for call to 'QPainter::drawText(QPainter*, QRect&)'
// here you have no text??
// look at the others, you need the last argument
} ^