sincnarf
28th June 2007, 21:23
I want to print a QGraphicsScene's contents. How do I do this? The following code is wrong
void MainWindow::print()
{
QPrinter printer;
if (QPrintDialog(&printer).exec() == QDialog::Accepted) {
QPainter painter(&printer);
painter.setRenderHint(QPainter::Antialiasing);
//QGraphicsScene scene = anotherQGraphicsView->scene();
//What lines of code should I use to get another QGraphicsView's scene
//No method like getScene() exists
scene->render(&painter);
}
}
void MainWindow::print()
{
QPrinter printer;
if (QPrintDialog(&printer).exec() == QDialog::Accepted) {
QPainter painter(&printer);
painter.setRenderHint(QPainter::Antialiasing);
//QGraphicsScene scene = anotherQGraphicsView->scene();
//What lines of code should I use to get another QGraphicsView's scene
//No method like getScene() exists
scene->render(&painter);
}
}