[Uml-devel] branches/work/soc-umbrello/umbrello

Andi Fischer andi.fischer at hispeed.ch
Tue Nov 29 17:03:18 UTC 2011


SVN commit 1266448 by fischer:

Patch from Ralf Habacker: For each printing a new QPrinter instance is used, which makes it impossible to reuse changed printer settings. This is fixed now.

 M  +6 -6      uml.cpp  
 M  +1 -1      uml.h  


--- branches/work/soc-umbrello/umbrello/uml.cpp #1266447:1266448
@@ -139,6 +139,8 @@
     m_doc = new UMLDoc();
     m_doc->init();
     m_hasBegunMacro = false;
+    m_printer = new QPrinter;
+    m_printer->setFullPage(true);
 
     readOptionState();
     initActions();
@@ -193,6 +195,7 @@
     delete m_copyTimer;
     delete m_refactoringAssist;
     delete m_pUndoStack;
+    delete m_printer;
 }
 
 /**
@@ -1272,12 +1275,9 @@
  */
 void UMLApp::slotPrintPreview()
 {
-    QPrinter printer;
-    printer.setFullPage(true);
-
     slotStatusMsg(i18n("Print Preview..."));
 
-	QPrintPreviewDialog *preview = new QPrintPreviewDialog(&printer,this);
+    QPrintPreviewDialog *preview = new QPrintPreviewDialog(m_printer,this);
 	connect(preview, SIGNAL(paintRequested(QPrinter *)), this, SLOT(slotPrintPreviewPaintRequested(QPrinter *)));
 	preview->exec();
 }
@@ -1304,11 +1304,11 @@
 
     DiagramPrintPage * selectPage = new DiagramPrintPage(0, m_doc);
     QPrintDialog *printDialog =
-                  KdePrint::createPrintDialog(&printer, QList<QWidget*>() << selectPage, this);
+                  KdePrint::createPrintDialog(m_printer, QList<QWidget*>() << selectPage, this);
     printDialog->setWindowTitle(i18n("Print %1", m_doc->url().prettyUrl()));
 
     if (printDialog->exec()) {
-        m_doc->print(&printer, selectPage);
+        m_doc->print(m_printer, selectPage);
     }
     delete printDialog;
     resetStatusMsg();
--- branches/work/soc-umbrello/umbrello/uml.h #1266447:1266448
@@ -414,7 +414,7 @@
     StatusBarToolButton* m_pZoomFullSBTB;
     QSlider* m_pZoomSlider;
     QLabel* m_statusBarMessage;
-
+    QPrinter *m_printer;
     /**
      * The running XHTML documentation generator. Null when no generation is running.
      */




More information about the umbrello-devel mailing list