Skip to content

Commit

Permalink
Allow compiling without print support
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Dec 20, 2016
1 parent dfd9833 commit aa64688
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/core/composer/qgscomposition.cpp
Expand Up @@ -2777,6 +2777,8 @@ void QgsComposition::deleteAndRemoveMultiFrames()
mMultiFrames.clear();
}

#ifndef QT_NO_PRINTER

void QgsComposition::beginPrintAsPDF( QPrinter& printer, const QString& file )
{
printer.setOutputFileName( file );
Expand Down Expand Up @@ -2808,6 +2810,8 @@ bool QgsComposition::exportAsPDF( const QString& file )
return print( printer );
}

#endif

void QgsComposition::georeferenceOutput( const QString& file, QgsComposerMap* map,
const QRectF& exportRegion, double dpi ) const
{
Expand Down Expand Up @@ -2836,6 +2840,8 @@ void QgsComposition::georeferenceOutput( const QString& file, QgsComposerMap* ma
delete[] t;
}

#ifndef QT_NO_PRINTER

void QgsComposition::doPrint( QPrinter& printer, QPainter& p, bool startNewPage )
{
if ( ddPageSizeActive() )
Expand Down Expand Up @@ -2929,6 +2935,8 @@ bool QgsComposition::print( QPrinter &printer, const bool evaluateDDPageSize )
return true;
}

#endif

QImage QgsComposition::printPageAsRaster( int page, QSize imageSize, int dpi )
{
int resolution = mPrintResolution;
Expand Down
3 changes: 2 additions & 1 deletion src/core/composer/qgscomposition.h
Expand Up @@ -608,8 +608,8 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
void setPreventCursorChange( const bool preventChange ) { mPreventCursorChange = preventChange; }
bool preventCursorChange() const { return mPreventCursorChange; }

#ifndef QT_NO_PRINTER
//printing

//! Prepare the printer for printing
void beginPrint( QPrinter& printer, const bool evaluateDDPageSize = false );
//! Prepare the printer for printing in a PDF
Expand All @@ -631,6 +631,7 @@ class CORE_EXPORT QgsComposition : public QGraphicsScene, public QgsExpressionCo
* @returns true if export was successful
*/
bool exportAsPDF( const QString& file );
#endif

/** Renders a composer page to an image.
* @param page page number, 0 based such that the first page is page 0
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgsprojectfiletransform.cpp
Expand Up @@ -268,6 +268,7 @@ void QgsProjectFileTransform::transform0100to0110()
{
if ( ! mDom.isNull() )
{
#ifndef QT_NO_PRINTER
//Change 'outlinewidth' in QgsSymbol
QPrinter myPrinter( QPrinter::ScreenResolution );
int screenDpi = myPrinter.resolution();
Expand Down Expand Up @@ -302,6 +303,7 @@ void QgsProjectFileTransform::transform0100to0110()
QDomText newPointSizeText = mDom.createTextNode( QString::number( static_cast< int >( pointSize ) ) );
currentPointSizeElem.replaceChild( newPointSizeText, pointSizeTextNode );
}
#endif
}
}

Expand Down
4 changes: 3 additions & 1 deletion src/core/qgswebview.h
Expand Up @@ -18,12 +18,12 @@


#include <QWidget>
#include <QPrinter>

#ifdef WITH_QTWEBKIT
#include <QWebView>
#include <QDesktopWidget>


/** \ingroup core
*/
class CORE_EXPORT QgsWebView : public QWebView
Expand All @@ -45,6 +45,8 @@ class CORE_EXPORT QgsWebView : public QWebView
#else
#include "qgswebpage.h"
#include <QTextBrowser>
class QPrinter;


/** \ingroup core
* @brief The QgsWebView class is a collection of stubs to mimic the API of QWebView on systems where the real
Expand Down
2 changes: 2 additions & 0 deletions src/core/raster/qgsrasterdrawer.cpp
Expand Up @@ -66,6 +66,7 @@ void QgsRasterDrawer::draw( QPainter* p, QgsRasterViewPort* viewPort, const QgsM

QImage img = block->image();

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

if ( feedback && feedback->renderPartialOutput() )
{
Expand Down

0 comments on commit aa64688

Please sign in to comment.