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

Peter Kümmel syntheticpp at gmx.net
Sun Oct 7 15:20:35 UTC 2012


SVN commit 1319577 by kuemmel:

add Qt5 print support

 M  +1 -0      cmake/CMakeLists.txt  
 M  +1 -1      cmake/modules/KstMacros.cmake  
 M  +2 -1      cmake/src/libkstapp/CMakeLists.txt  
 M  +7 -0      src/libkstapp/mainwindow.cpp  


--- branches/work/kst/portto4/kst/cmake/CMakeLists.txt #1319576:1319577
@@ -138,6 +138,7 @@
 	use_qt5lib(Qt5Widgets)
 	use_qt5lib(Qt5Network)
 	use_qt5lib(Qt5Xml)
+	use_qt5lib(Qt5PrintSupport)
 	if(kst_opengl)
 	use_qt5lib(Qt5OpenGL)
 	else()
--- branches/work/kst/portto4/kst/cmake/modules/KstMacros.cmake #1319576:1319577
@@ -196,7 +196,7 @@
 macro(kst_link)
 	target_link_libraries(${kst_name} ${ARGV})
 	if(kst_qt5)
-		qt5_use_modules(${kst_name} Widgets Xml Network)
+		qt5_use_modules(${kst_name} Widgets Xml Network PrintSupport)
 		if(kst_opengl)
 			qt5_use_modules(${kst_name} OpenGL)
 		endif()
--- branches/work/kst/portto4/kst/cmake/src/libkstapp/CMakeLists.txt #1319576:1319577
@@ -2,7 +2,8 @@
 
 if(kst_qt5 AND kst_qt5base_only)
     kst_files_ignore(svgitem)
-    add_definitions(-DKST_NO_PRINTER -DKST_NO_SVG)
+	add_definitions(-DKST_NO_SVG)
+	#add_definitions(-DKST_NO_PRINTER)
 	if(UNIX)
 		set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
 	endif()
--- branches/work/kst/portto4/kst/src/libkstapp/mainwindow.cpp #1319576:1319577
@@ -521,7 +521,11 @@
     } else if (format == QString("eps")) {
 #ifndef KST_NO_PRINTER
       QPrinter printer(QPrinter::ScreenResolution);
+#ifdef QT5
+      printer.setOutputFormat(QPrinter::PdfFormat);
+#else
       printer.setOutputFormat(QPrinter::PostScriptFormat);
+#endif
       printer.setOutputFileName(file);
       printer.setOrientation(QPrinter::Portrait);
 
@@ -979,6 +983,9 @@
   _printAct->setStatusTip(tr("Print the current view"));
   _printAct->setIcon(QPixmap(":document-print.png"));
   connect(_printAct, SIGNAL(triggered()), this, SLOT(print()));
+#ifdef KST_NO_PRINTER
+  _printAct->setEnabled(false);
+#endif
 
   _exportGraphicsAct = new QAction(tr("&Export as Image(s)..."), this);
   _exportGraphicsAct->setStatusTip(tr("Export graphics to disk"));


More information about the Kst mailing list