[Kst] branches/work/kst/portto4/kst/src/libkstapp
Barth Netterfield
netterfield at astro.utoronto.ca
Mon Apr 11 15:31:37 CEST 2011
SVN commit 1227651 by netterfield:
Fix some bugs with exporting images:
-Use specified path when exporting plots with multiple pages.
-Make exporting plots with multiple pages work for eps and pdf formats.
-Don't store automatically specified extension in default.
M +2 -1 exportgraphicsdialog.cpp
M +7 -7 mainwindow.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/exportgraphicsdialog.cpp #1227650:1227651
@@ -145,13 +145,14 @@
void ExportGraphicsDialog::createFile() {
QString filename = _saveLocation->file();
+ QString default_filename = filename;
QString format = _comboBoxFormats->currentText();
if (_autoExtension->isChecked()) {
if (QFileInfo(filename).suffix().toLower() != format.toLower()) {
filename += '.' + format;
}
}
- _dialogDefaults->setValue("export/filename", filename);
+ _dialogDefaults->setValue("export/filename", default_filename);
_dialogDefaults->setValue("export/format", format);
_dialogDefaults->setValue("export/xsize", _xSize->value());
_dialogDefaults->setValue("export/ysize", _ySize->value());
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1227650:1227651
@@ -427,7 +427,8 @@
const QString &filename, const QString &format, int width, int height, int display) {
int viewCount = 0;
int n_views = _tabWidget->views().size();
- foreach (View *view, _tabWidget->views()) {
+ for (int i_view = 0; i_view<n_views; i_view++) {
+ View *view = _tabWidget->views().at(i_view);
QSize size;
if (display == 0) {
QSize sizeWindow(view->geometry().size());
@@ -449,12 +450,11 @@
QString file = filename;
if (n_views != 1) {
QFileInfo QFI(filename);
- file = QFI.completeBaseName() +
+ file = QFI.dir().path() + '/' + QFI.completeBaseName() +
'_' +
QString::number(viewCount+1) + '.' +
QFI.suffix();
}
-
if (format == QString("svg")) {
QPainter painter;
QSvgGenerator generator;
@@ -484,7 +484,8 @@
printer.setOutputFileName(file);
setPrinterDefaults(&printer);
- printer.setPrintRange(QPrinter::CurrentPage);
+ printer.setPrintRange(QPrinter::PageRange);
+ printer.setFromTo(i_view+1, i_view+1);
printer.setPaperSize(size, QPrinter::DevicePixel);
printToPrinter(&printer);
@@ -495,7 +496,8 @@
printer.setOutputFileName(file);
setPrinterDefaults(&printer);
- printer.setPrintRange(QPrinter::CurrentPage);
+ printer.setPrintRange(QPrinter::PageRange);
+ printer.setFromTo(i_view+1, i_view+1);
printer.setPaperSize(size, QPrinter::DevicePixel);
printToPrinter(&printer);
@@ -1706,8 +1708,6 @@
void MainWindow::showExportVectorsDialog() {
if (!_exportVectors) {
_exportVectors = new ExportVectorsDialog(this);
- //connect(_exportVectors, SIGNAL(exportGraphics(const QString &, const QString &, int, int, int)),
- // this, SLOT(exportGraphicsFile(const QString &, const QString &, int, int, int)));
}
if (_exportVectors->isVisible()) {
_exportVectors->raise();
More information about the Kst
mailing list