I have a QGraphicsView application that handles drawing lines between nodes. The nodes represent holes that will be drilled into a test fixture and the lines are wires between the nodes. I am trying to print out just the nodes, so that the printout can be affixed over the actual test fixture.
The problem I'm having is that when I run the following code:
void GraphicsViewer::Print()
{
printer.
setPageSize( QPrinter::Letter );
printer.
setOrientation( QPrinter::Portrait );
if( dialog.
exec() == QDialog::Accepted ) {
GetGraphicsView()->scene()->render( &painter );
}
}
void GraphicsViewer::Print()
{
QPrinter printer( QPrinter::ScreenResolution );
printer.setPageSize( QPrinter::Letter );
printer.setOrientation( QPrinter::Portrait );
QPrintDialog dialog( &printer, this );
if( dialog.exec() == QDialog::Accepted )
{
QPainter painter(&printer);
GetGraphicsView()->scene()->render( &painter );
}
}
To copy to clipboard, switch view to plain text mode
The printout is scaled to fit the page because of the aspectRatioMode argument to the render function. How do I tell the render function that I do not want to scale to fit the page, and I want a true what you see is what you get representation of my QGraphicsScene on the paper?
Bookmarks