Skip to content

Commit aa64688

Browse files
committedDec 20, 2016
Allow compiling without print support
1 parent dfd9833 commit aa64688

File tree

5 files changed

+17
-2
lines changed

5 files changed

+17
-2
lines changed
 

‎src/core/composer/qgscomposition.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2777,6 +2777,8 @@ void QgsComposition::deleteAndRemoveMultiFrames()
27772777
mMultiFrames.clear();
27782778
}
27792779

2780+
#ifndef QT_NO_PRINTER
2781+
27802782
void QgsComposition::beginPrintAsPDF( QPrinter& printer, const QString& file )
27812783
{
27822784
printer.setOutputFileName( file );
@@ -2808,6 +2810,8 @@ bool QgsComposition::exportAsPDF( const QString& file )
28082810
return print( printer );
28092811
}
28102812

2813+
#endif
2814+
28112815
void QgsComposition::georeferenceOutput( const QString& file, QgsComposerMap* map,
28122816
const QRectF& exportRegion, double dpi ) const
28132817
{
@@ -2836,6 +2840,8 @@ void QgsComposition::georeferenceOutput( const QString& file, QgsComposerMap* ma
28362840
delete[] t;
28372841
}
28382842

2843+
#ifndef QT_NO_PRINTER
2844+
28392845
void QgsComposition::doPrint( QPrinter& printer, QPainter& p, bool startNewPage )
28402846
{
28412847
if ( ddPageSizeActive() )
@@ -2929,6 +2935,8 @@ bool QgsComposition::print( QPrinter &printer, const bool evaluateDDPageSize )
29292935
return true;
29302936
}
29312937

2938+
#endif
2939+
29322940
QImage QgsComposition::printPageAsRaster( int page, QSize imageSize, int dpi )
29332941
{
29342942
int resolution = mPrintResolution;

‎src/core/composer/qgscomposition.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,8 +608,8 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
608608
void setPreventCursorChange( const bool preventChange ) { mPreventCursorChange = preventChange; }
609609
bool preventCursorChange() const { return mPreventCursorChange; }
610610

611+
#ifndef QT_NO_PRINTER
611612
//printing
612-
613613
//! Prepare the printer for printing
614614
void beginPrint( QPrinter& printer, const bool evaluateDDPageSize = false );
615615
//! Prepare the printer for printing in a PDF
@@ -631,6 +631,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
631631
* @returns true if export was successful
632632
*/
633633
bool exportAsPDF( const QString& file );
634+
#endif
634635

635636
/** Renders a composer page to an image.
636637
* @param page page number, 0 based such that the first page is page 0

‎src/core/qgsprojectfiletransform.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,7 @@ void QgsProjectFileTransform::transform0100to0110()
268268
{
269269
if ( ! mDom.isNull() )
270270
{
271+
#ifndef QT_NO_PRINTER
271272
//Change 'outlinewidth' in QgsSymbol
272273
QPrinter myPrinter( QPrinter::ScreenResolution );
273274
int screenDpi = myPrinter.resolution();
@@ -302,6 +303,7 @@ void QgsProjectFileTransform::transform0100to0110()
302303
QDomText newPointSizeText = mDom.createTextNode( QString::number( static_cast< int >( pointSize ) ) );
303304
currentPointSizeElem.replaceChild( newPointSizeText, pointSizeTextNode );
304305
}
306+
#endif
305307
}
306308
}
307309

‎src/core/qgswebview.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@
1818

1919

2020
#include <QWidget>
21-
#include <QPrinter>
2221

2322
#ifdef WITH_QTWEBKIT
2423
#include <QWebView>
2524
#include <QDesktopWidget>
2625

26+
2727
/** \ingroup core
2828
*/
2929
class CORE_EXPORT QgsWebView : public QWebView
@@ -45,6 +45,8 @@ class CORE_EXPORT QgsWebView : public QWebView
4545
#else
4646
#include "qgswebpage.h"
4747
#include <QTextBrowser>
48+
class QPrinter;
49+
4850

4951
/** \ingroup core
5052
* @brief The QgsWebView class is a collection of stubs to mimic the API of QWebView on systems where the real

‎src/core/raster/qgsrasterdrawer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ void QgsRasterDrawer::draw( QPainter* p, QgsRasterViewPort* viewPort, const QgsM
6666

6767
QImage img = block->image();
6868

69+
#ifndef QT_NO_PRINTER
6970
// Because of bug in Acrobat Reader we must use "white" transparent color instead
7071
// of "black" for PDF. See #9101.
7172
QPrinter *printer = dynamic_cast<QPrinter *>( p->device() );
@@ -87,6 +88,7 @@ void QgsRasterDrawer::draw( QPainter* p, QgsRasterViewPort* viewPort, const QgsM
8788
}
8889
}
8990
}
91+
#endif
9092

9193
if ( feedback && feedback->renderPartialOutput() )
9294
{

0 commit comments

Comments
 (0)
Please sign in to comment.