Here is the snippet that does prepares the GraphicsView for printing.
void GraphicsView
::brender(QPainter* painter,
const QRect
& rect,
const QRect
& target
) {
// a little bit of trickery to get the plot to scale right when printed
rect.x() * 1000,
rect.y() * 1000,
rect.width() * 1000,
rect.height() * 1000
);
render(painter, target.translated((viewport()->rect().width() > target.width() ? (-(viewport()->rect().width() - target.width())/2) : 0), 0), rect);
}
void GraphicsView::brender(QPainter* painter, const QRect& rect, const QRect& target)
{
// a little bit of trickery to get the plot to scale right when printed
pview_rect = QRectF(
rect.x() * 1000,
rect.y() * 1000,
rect.width() * 1000,
rect.height() * 1000
);
render(painter, target.translated((viewport()->rect().width() > target.width() ? (-(viewport()->rect().width() - target.width())/2) : 0), 0), rect);
pview_rect = QRectF();
}
To copy to clipboard, switch view to plain text mode
Bookmarks