[PATCH 3/5] Fix NO_PRINTING when printing is disabled in Qt
Anton Lundin
glance at acc.umu.se
Wed Jul 1 08:08:35 PDT 2015
Qt for android doesn't have any printing support, so this fixes
NO_PRINTING so we can build against a Qt without any printing support at
all.
Signed-off-by: Anton Lundin <glance at acc.umu.se>
---
CMakeLists.txt | 6 ++++--
qt-ui/printdialog.cpp | 2 +-
qt-ui/printdialog.h | 2 +-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3fe2d87..f92afea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,6 +120,8 @@ else()
printer.cpp
templatelayout.cpp
)
+ set(PRINTING_PKG PrintSupport)
+ set(PRINTING_LIB Qt5::PrintSupport)
endif()
if(NO_USERMANUAL)
@@ -153,8 +155,8 @@ if(SUBSURFACE_MOBILE)
set(QT_QUICK_PKG Quick)
set(QT_QUICK_LIB Qt5::Quick)
endif()
-find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} PrintSupport Svg Test LinguistTools ${QT_QUICK_PKG})
-set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} Qt5::PrintSupport Qt5::Svg ${QT_QUICK_LIB})
+find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG})
+set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_PKG})
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
# Generate the ssrf-config.h every 'make'
diff --git a/qt-ui/printdialog.cpp b/qt-ui/printdialog.cpp
index 4a33146..6f30f89 100644
--- a/qt-ui/printdialog.cpp
+++ b/qt-ui/printdialog.cpp
@@ -2,6 +2,7 @@
#include "printoptions.h"
#include "mainwindow.h"
+#ifndef NO_PRINTING
#include <QProgressBar>
#include <QPrintPreviewDialog>
#include <QPrintDialog>
@@ -10,7 +11,6 @@
#define SETTINGS_GROUP "PrintDialog"
-#ifndef NO_PRINTING
PrintDialog::PrintDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f)
{
// check if the options were previously stored in the settings; if not use some defaults.
diff --git a/qt-ui/printdialog.h b/qt-ui/printdialog.h
index 9937cd5..a340374 100644
--- a/qt-ui/printdialog.h
+++ b/qt-ui/printdialog.h
@@ -1,12 +1,12 @@
#ifndef PRINTDIALOG_H
#define PRINTDIALOG_H
+#ifndef NO_PRINTING
#include <QDialog>
#include <QPrinter>
#include "printoptions.h"
#include "printer.h"
-#ifndef NO_PRINTING
class QProgressBar;
class PrintOptions;
class PrintLayout;
--
2.1.4
More information about the subsurface
mailing list