[Kst] branches/work/kst/portto4/kst/src/libkstapp

Barth Netterfield netterfield at astro.utoronto.ca
Mon Oct 31 13:01:16 UTC 2011


SVN commit 1261782 by netterfield:

Add default path to print to file.
Fix orientation for export to eps and pdf.


 M  +5 -6      mainwindow.cpp  


--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1261781:1261782
@@ -507,7 +507,7 @@
       QPrinter printer(QPrinter::ScreenResolution);
       printer.setOutputFormat(QPrinter::PostScriptFormat);
       printer.setOutputFileName(file);
-      setPrinterDefaults(&printer);
+      printer.setOrientation(QPrinter::Portrait);
 
       printer.setPrintRange(QPrinter::PageRange);
       printer.setFromTo(i_view+1, i_view+1);
@@ -519,7 +519,8 @@
       QPrinter printer(QPrinter::ScreenResolution);
       printer.setOutputFormat(QPrinter::PdfFormat);
       printer.setOutputFileName(file);
-      setPrinterDefaults(&printer);
+      //setPrinterDefaults(&printer);
+      printer.setOrientation(QPrinter::Portrait);
 
       printer.setPrintRange(QPrinter::PageRange);
       printer.setFromTo(i_view+1, i_view+1);
@@ -682,15 +683,12 @@
 }
 
 void MainWindow::print() {
-  // line widths in pixels make sense when using ScreenResolution
-  // FIXME: come up with a better definition of line width!
   QPrinter printer(QPrinter::ScreenResolution);
-  //QPrinter printer(QPrinter::HighResolution);
   printer.setResolution(300);
-  qDebug() << "resolution: " << printer.resolution();
 
   setPrinterDefaults(&printer);
 
+  printer.setOutputFileName(_dialogDefaults->value("print/path", "./print.pdf").toString());
   QPointer<QPrintDialog> pd = new QPrintDialog(&printer, this);
 #if QT_VERSION >= 0x040500
   pd->setOption(QPrintDialog::PrintToFile);
@@ -704,6 +702,7 @@
     QApplication::restoreOverrideCursor();
     savePrinterDefaults(&printer);
   }
+  _dialogDefaults->setValue("print/path", printer.outputFileName());
   delete pd;
 }
 


More information about the Kst mailing list