diff -r 6cbf3c9cbd21 -r ffb02a9bb508 mapeditor.cpp --- a/mapeditor.cpp Wed Jul 22 11:48:23 2009 +0000 +++ b/mapeditor.cpp Mon Jul 27 12:53:17 2009 +0000 @@ -304,7 +304,7 @@ printer->setOutputFileName(settings.value("/mainwindow/printerFileName",printer->outputFileName()).toString()); } - QRectF totalBBox=model->getTotalBBox(); + QRectF totalBBox=getTotalBBox(); // Try to set orientation automagically // Note: Interpretation of generated postscript is amibiguous, if @@ -386,6 +386,39 @@ } } +QRectF MapEditor::getTotalBBox() //FIXME-2 needed e.g. for image export +{ + QRectF r; +/* + for (int i=0;ibranchCount(); i++) + r=addBBox (rootItem->getBranchNum(i)->getTotalBBox(), r); +*/ + return r; +} + + +QPixmap MapEditor::getPixmap() +{ + QRectF mapRect=getTotalBBox(); + QPixmap pix((int)mapRect.width()+2,(int)mapRect.height()+1); + QPainter pp (&pix); + + pp.setRenderHints(renderHints()); + + // Don't print the visualisation of selection + model->unselect(); + + mapScene->render ( &pp, + QRectF(0,0,mapRect.width()+2,mapRect.height()+2), + QRectF(mapRect.x(),mapRect.y(),mapRect.width(),mapRect.height() )); + + // Restore selection + model->reselect(); + + return pix; +} + + void MapEditor::setAntiAlias (bool b) { setRenderHint(QPainter::Antialiasing,b);