summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <[email protected]>2015-06-16 23:31:43 +0200
committerRalf Habacker <[email protected]>2015-06-16 23:31:43 +0200
commitaf8679befd1251475a4bcfdab5e6582a88d065d2 (patch)
tree7af5caaddc3f53c36ecee5b5ff51422eb934901b
parent99ba6ce98482f965a5639a06ec7309b13c58ec22 (diff)
Fix 'SVG export image does not look like the actual diagram'.
The with and height of the exported file need to match the font resolution to get what is displayed on the screen. BUG:349234 FIXED-IN:2.16.3 (KDE Applications 15.04.3)
-rw-r--r--umbrello/umlviewimageexportermodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/umbrello/umlviewimageexportermodel.cpp b/umbrello/umlviewimageexportermodel.cpp
index 8f15d3f..6b41829 100644
--- a/umbrello/umlviewimageexportermodel.cpp
+++ b/umbrello/umlviewimageexportermodel.cpp
@@ -418,7 +418,6 @@ bool UMLViewImageExporterModel::exportViewToEps(UMLScene* scene, const QString &
printer.setOutputFileName(fileName);
printer.setOutputFormat(QPrinter::PostScriptFormat);
printer.setColorMode(QPrinter::Color);
- printer.setPageSize(QPrinter::Custom);
printer.setPaperSize(paperSize, QPrinter::Millimeter);
printer.setPageMargins(paperSize.width() * border, paperSize.height() * border, 0, 0, QPrinter::Millimeter);
printer.setResolution(qApp->desktop()->logicalDpiX());
@@ -465,6 +464,7 @@ bool UMLViewImageExporterModel::exportViewToSvg(UMLScene* scene, const QString &
QSvgGenerator generator;
generator.setFileName(fileName);
generator.setSize(rect.toRect().size());
+ generator.setResolution(qApp->desktop()->logicalDpiX());
generator.setViewBox(QRect(0, 0, rect.width(), rect.height()));
QPainter painter(&generator);
@@ -509,7 +509,9 @@ bool UMLViewImageExporterModel::exportViewToPixmap(UMLScene* scene, const QStrin
}
QRectF rect = scene->diagramRect();
- QPixmap diagram(rect.width(), rect.height());
+ float scale = 72.0f / qApp->desktop()->logicalDpiX();
+ QSizeF size = rect.size() * scale;
+ QPixmap diagram(size.toSize());
scene->getDiagram(diagram, rect);
bool exportSuccessful = diagram.save(fileName, qPrintable(imageType.toUpper()));
DEBUG(DBG_IEM) << "saving to file " << fileName