Fichier > exporter permet desormais d'enregistrer les schemas au format SVG.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@159 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavierqet
2007-10-05 12:06:39 +00:00
parent 7b71cbb7ae
commit 579783bba5
5 changed files with 93 additions and 38 deletions

View File

@@ -127,7 +127,7 @@ void Diagram::keyReleaseEvent(QKeyEvent *e) {
Exporte le schema vers une image
@return Une QImage representant le schema
*/
QImage Diagram::toImage(int width, int height, Qt::AspectRatioMode aspectRatioMode) {
bool Diagram::toPaintDevice(QPaintDevice &pix, int width, int height, Qt::AspectRatioMode aspectRatioMode) {
// determine la zone source = contenu du schema + marges
QRectF source_area;
if (!use_border) {
@@ -147,12 +147,9 @@ QImage Diagram::toImage(int width, int height, Qt::AspectRatioMode aspectRatioMo
// si les dimensions ne sont pas precisees, l'image est exportee a l'echelle 1:1
QSize image_size = (width == -1 && height == -1) ? source_area.size().toSize() : QSize(width, height);
// initialise une image avec ces dimensions
QImage pix = QImage(image_size, QImage::Format_RGB32);
// prepare le rendu
QPainter p;
if (!p.begin(&pix)) return(QImage());
if (!p.begin(&pix)) return(false);
// rendu antialiase
p.setRenderHint(QPainter::Antialiasing, true);
@@ -164,13 +161,13 @@ QImage Diagram::toImage(int width, int height, Qt::AspectRatioMode aspectRatioMo
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(false);
// effectue le rendu lui-meme
render(&p, pix.rect(), source_area, aspectRatioMode);
render(&p, QRect(QPoint(0, 0), image_size), source_area, aspectRatioMode);
p.end();
// restaure les elements selectionnes
foreach (QGraphicsItem *qgi, selected_elmts) qgi -> setSelected(true);
return(pix);
return(true);
}
/**