build fix for the case when QT_NO_PDF is defined

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-02-25 20:44:53 +02:00
parent 91b178316d
commit dab0197f4e
4 changed files with 31 additions and 26 deletions

View file

@ -244,6 +244,18 @@ namespace QPdf {
}
}
QPdfPage::QPdfPage()
: QPdf::ByteStream(true) // Enable file backing
{
}
void QPdfPage::streamImage(int w, int h, int object)
{
*this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n";
if (!images.contains(object))
images.append(object);
}
QByteArray QPdf::generatePath(const QPainterPath &path, const QTransform &matrix, PathFlags flags)
{
QByteArray result;

View file

@ -36,7 +36,7 @@
#include "qcorecommon_p.h"
#include "qguicommon_p.h"
#ifndef QT_NO_PRINTER
#ifndef QT_NO_PDF
#include <limits.h>
#include <math.h>
@ -49,19 +49,6 @@ QT_BEGIN_NAMESPACE
// Can't use it though, as gs generates completely wrong images if this is true.
static const bool interpolateImages = false;
QPdfPage::QPdfPage()
: QPdf::ByteStream(true) // Enable file backing
{
}
void QPdfPage::streamImage(int w, int h, int object)
{
*this << w << "0 0 " << -h << "0 " << h << "cm /Im" << object << " Do\n";
if (!images.contains(object))
images.append(object);
}
inline QPaintEngine::PaintEngineFeatures qt_pdf_decide_features()
{
QPaintEngine::PaintEngineFeatures f = QPaintEngine::AllFeatures;
@ -1090,8 +1077,4 @@ void QPdfEnginePrivate::printString(const QString &string) {
QT_END_NAMESPACE
#endif // QT_NO_PRINTER
#endif // QT_NO_PDF

View file

@ -35,7 +35,8 @@
#include "QtGui/qprintengine.h"
#ifndef QT_NO_PRINTER
#ifndef QT_NO_PDF
#include "QtCore/qmap.h"
#include "QtGui/qmatrix.h"
#include "QtCore/qstring.h"
@ -170,6 +171,6 @@ private:
QT_END_NAMESPACE
#endif // QT_NO_PRINTER
#endif // QT_NO_PDF
#endif // QPRINTENGINE_PDF_P_H

View file

@ -131,9 +131,13 @@ void QPrinterPrivate::createDefaultEngines()
{
switch (outputFormat) {
case QPrinter::PdfFormat: {
#ifndef QT_NO_PDF
QPdfEngine *pdfEngine = new QPdfEngine(printerMode);
paintEngine = pdfEngine;
printEngine = pdfEngine;
#else
qWarning("QPrinter: PDF output format is disabled");
#endif // QT_NO_PDF
break;
}
case QPrinter::NativeFormat: // falltrough
@ -545,7 +549,11 @@ QPrinter::QPrinter(PrinterMode mode)
if (!defPrn.isNull()) {
setPrinterName(defPrn.printerName());
} else if (QPrinterInfo::availablePrinters().isEmpty()) {
#ifndef QT_NO_PDF
setOutputFormat(QPrinter::PdfFormat);
#else
setOutputFormat(QPrinter::NativeFormat);
#endif
}
}
@ -657,7 +665,11 @@ QPrinter::~QPrinter()
void QPrinter::setOutputFormat(OutputFormat format)
{
#ifndef QT_NO_PDF
#ifdef QT_NO_PDF
if (format == QPrinter::PdfFormat) {
return;
}
#endif // QT_NO_PDF
Q_D(QPrinter);
if (d->validPrinter && d->outputFormat == format)
return;
@ -689,9 +701,6 @@ void QPrinter::setOutputFormat(OutputFormat format)
if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat)
d->validPrinter = true;
#else
Q_UNUSED(format);
#endif
}
/*!
@ -1878,7 +1887,7 @@ void QPrinter::setFromTo(int from, int to)
{
Q_D(QPrinter);
if (from > to) {
qWarning() << "QPrinter::setFromTo: 'from' must be less than or equal to 'to'";
qWarning("QPrinter::setFromTo: 'from' must be less than or equal to 'to'");
from = to;
}
d->fromPage = from;