qprintengine_pdf.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qprintengine_pdf.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Contact: https://www.qt.io/licensing/-
5**-
6** This file is part of the QtGui module of the Qt Toolkit.-
7**-
8** $QT_BEGIN_LICENSE:LGPL$-
9** Commercial License Usage-
10** Licensees holding valid commercial Qt licenses may use this file in-
11** accordance with the commercial license agreement provided with the-
12** Software or, alternatively, in accordance with the terms contained in-
13** a written agreement between you and The Qt Company. For licensing terms-
14** and conditions see https://www.qt.io/terms-conditions. For further-
15** information use the contact form at https://www.qt.io/contact-us.-
16**-
17** GNU Lesser General Public License Usage-
18** Alternatively, this file may be used under the terms of the GNU Lesser-
19** General Public License version 3 as published by the Free Software-
20** Foundation and appearing in the file LICENSE.LGPL3 included in the-
21** packaging of this file. Please review the following information to-
22** ensure the GNU Lesser General Public License version 3 requirements-
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
24**-
25** GNU General Public License Usage-
26** Alternatively, this file may be used under the terms of the GNU-
27** General Public License version 2.0 or (at your option) the GNU General-
28** Public license version 3 or any later version approved by the KDE Free-
29** Qt Foundation. The licenses are as published by the Free Software-
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
31** included in the packaging of this file. Please review the following-
32** information to ensure the GNU General Public License requirements will-
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
34** https://www.gnu.org/licenses/gpl-3.0.html.-
35**-
36** $QT_END_LICENSE$-
37**-
38****************************************************************************/-
39-
40#include "qprintengine_pdf_p.h"-
41-
42#ifndef QT_NO_PRINTER-
43-
44#include <qiodevice.h>-
45#include <qfile.h>-
46#include <qdebug.h>-
47#include <qbuffer.h>-
48#include "qprinterinfo.h"-
49#include <QtGui/qpagelayout.h>-
50-
51#ifdef Q_OS_UNIX-
52#include "private/qcore_unix_p.h" // overrides QT_OPEN-
53#endif-
54-
55#ifdef Q_OS_WIN-
56#include <io.h> // _close.-
57#endif-
58-
59QT_BEGIN_NAMESPACE-
60-
61QPdfPrintEngine::QPdfPrintEngine(QPrinter::PrinterMode m)-
62 : QPdfEngine(*new QPdfPrintEnginePrivate(m))-
63{-
64 state = QPrinter::Idle;-
65}
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
66-
67QPdfPrintEngine::QPdfPrintEngine(QPdfPrintEnginePrivate &p)-
68 : QPdfEngine(p)-
69{-
70 state = QPrinter::Idle;-
71}
never executed: end of block
0
72-
73QPdfPrintEngine::~QPdfPrintEngine()-
74{-
75}-
76-
77bool QPdfPrintEngine::begin(QPaintDevice *pdev)-
78{-
79 Q_D(QPdfPrintEngine);-
80-
81 if (!d->openPrintDevice()) {
!d->openPrintDevice()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QPrinter
1-20
82 state = QPrinter::Error;-
83 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QPrinter
1
84 }-
85 state = QPrinter::Active;-
86-
87 return QPdfEngine::begin(pdev);
executed 20 times by 1 test: return QPdfEngine::begin(pdev);
Executed by:
  • tst_QPrinter
20
88}-
89-
90bool QPdfPrintEngine::end()-
91{-
92 Q_D(QPdfPrintEngine);-
93-
94 QPdfEngine::end();-
95-
96 d->closePrintDevice();-
97 state = QPrinter::Idle;-
98-
99 return true;
executed 20 times by 1 test: return true;
Executed by:
  • tst_QPrinter
20
100}-
101-
102bool QPdfPrintEngine::newPage()-
103{-
104 return QPdfEngine::newPage();
never executed: return QPdfEngine::newPage();
0
105}-
106-
107int QPdfPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const-
108{-
109 return QPdfEngine::metric(m);
executed 193 times by 1 test: return QPdfEngine::metric(m);
Executed by:
  • tst_QPrinter
193
110}-
111-
112void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)-
113{-
114 Q_D(QPdfPrintEngine);-
115-
116 switch (int(key)) {-
117-
118 // The following keys are properties or derived values and so cannot be set-
119 case PPK_PageRect:
never executed: case PPK_PageRect:
0
120 break;
never executed: break;
0
121 case PPK_PaperRect:
never executed: case PPK_PaperRect:
0
122 break;
never executed: break;
0
123 case PPK_PaperSources:
never executed: case PPK_PaperSources:
0
124 break;
never executed: break;
0
125 case PPK_SupportsMultipleCopies:
never executed: case PPK_SupportsMultipleCopies:
0
126 break;
never executed: break;
0
127 case PPK_SupportedResolutions:
never executed: case PPK_SupportedResolutions:
0
128 break;
never executed: break;
0
129-
130 // The following keys are settings that are unsupported by the PDF PrintEngine-
131 case PPK_CustomBase:
never executed: case PPK_CustomBase:
0
132 break;
never executed: break;
0
133-
134 // The following keys are properties and settings that are supported by the PDF PrintEngine-
135 case PPK_CollateCopies:
executed 1 time by 1 test: case PPK_CollateCopies:
Executed by:
  • tst_QPrinter
1
136 d->collate = value.toBool();-
137 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
138 case PPK_ColorMode:
executed 1 time by 1 test: case PPK_ColorMode:
Executed by:
  • tst_QPrinter
1
139 d->grayscale = (QPrinter::ColorMode(value.toInt()) == QPrinter::GrayScale);-
140 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
141 case PPK_Creator:
executed 1 time by 1 test: case PPK_Creator:
Executed by:
  • tst_QPrinter
1
142 d->creator = value.toString();-
143 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
144 case PPK_DocumentName:
executed 2 times by 1 test: case PPK_DocumentName:
Executed by:
  • tst_QPrinter
2
145 d->title = value.toString();-
146 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
147 case PPK_FullPage:
executed 19 times by 1 test: case PPK_FullPage:
Executed by:
  • tst_QPrinter
19
148 if (value.toBool())
value.toBool()Description
TRUEevaluated 14 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QPrinter
5-14
149 d->m_pageLayout.setMode(QPageLayout::FullPageMode);
executed 14 times by 1 test: d->m_pageLayout.setMode(QPageLayout::FullPageMode);
Executed by:
  • tst_QPrinter
14
150 else-
151 d->m_pageLayout.setMode(QPageLayout::StandardMode);
executed 5 times by 1 test: d->m_pageLayout.setMode(QPageLayout::StandardMode);
Executed by:
  • tst_QPrinter
5
152 break;
executed 19 times by 1 test: break;
Executed by:
  • tst_QPrinter
19
153 case PPK_CopyCount: // fallthrough
executed 1 time by 1 test: case PPK_CopyCount:
Executed by:
  • tst_QPrinter
1
154 case PPK_NumberOfCopies:
executed 1 time by 1 test: case PPK_NumberOfCopies:
Executed by:
  • tst_QPrinter
1
155 d->copies = value.toInt();-
156 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
157 case PPK_Orientation:
executed 48 times by 1 test: case PPK_Orientation:
Executed by:
  • tst_QPrinter
48
158 d->m_pageLayout.setOrientation(QPageLayout::Orientation(value.toInt()));-
159 break;
executed 48 times by 1 test: break;
Executed by:
  • tst_QPrinter
48
160 case PPK_OutputFileName:
executed 39 times by 1 test: case PPK_OutputFileName:
Executed by:
  • tst_QPrinter
39
161 d->outputFileName = value.toString();-
162 break;
executed 39 times by 1 test: break;
Executed by:
  • tst_QPrinter
39
163 case PPK_PageOrder:
executed 1 time by 1 test: case PPK_PageOrder:
Executed by:
  • tst_QPrinter
1
164 d->pageOrder = QPrinter::PageOrder(value.toInt());-
165 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
166 case PPK_PageSize: {
never executed: case PPK_PageSize:
0
167 QPageSize pageSize = QPageSize(QPageSize::PageSizeId(value.toInt()));-
168 if (pageSize.isValid())
pageSize.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
169 d->m_pageLayout.setPageSize(pageSize);
never executed: d->m_pageLayout.setPageSize(pageSize);
0
170 break;
never executed: break;
0
171 }-
172 case PPK_PaperName: {
never executed: case PPK_PaperName:
0
173 QString name = value.toString();-
174 for (int i = 0; i <= QPageSize::LastPageSize; ++i) {
i <= QPageSize::LastPageSizeDescription
TRUEnever evaluated
FALSEnever evaluated
0
175 QPageSize pageSize = QPageSize(QPageSize::PageSizeId(i));-
176 if (name == pageSize.name()) {
name == pageSize.name()Description
TRUEnever evaluated
FALSEnever evaluated
0
177 d->m_pageLayout.setPageSize(pageSize);-
178 break;
never executed: break;
0
179 }-
180 }
never executed: end of block
0
181 break;
never executed: break;
0
182 }-
183 case PPK_WindowsPageSize:
executed 1 time by 1 test: case PPK_WindowsPageSize:
Executed by:
  • tst_QPrinter
1
184 d->m_pageLayout.setPageSize(QPageSize(QPageSize::id(value.toInt())));-
185 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
186 case PPK_PaperSource:
executed 1 time by 1 test: case PPK_PaperSource:
Executed by:
  • tst_QPrinter
1
187 d->paperSource = QPrinter::PaperSource(value.toInt());-
188 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
189 case PPK_PrinterName:
executed 128 times by 2 tests: case PPK_PrinterName:
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
190 d->printerName = value.toString();-
191 break;
executed 128 times by 2 tests: break;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
192 case PPK_PrinterProgram:
executed 1 time by 1 test: case PPK_PrinterProgram:
Executed by:
  • tst_QPrinter
1
193 d->printProgram = value.toString();-
194 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
195 case PPK_Resolution:
executed 27 times by 1 test: case PPK_Resolution:
Executed by:
  • tst_QPrinter
27
196 d->resolution = value.toInt();-
197 break;
executed 27 times by 1 test: break;
Executed by:
  • tst_QPrinter
27
198 case PPK_SelectionOption:
executed 1 time by 1 test: case PPK_SelectionOption:
Executed by:
  • tst_QPrinter
1
199 d->selectionOption = value.toString();-
200 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
201 case PPK_FontEmbedding:
executed 1 time by 1 test: case PPK_FontEmbedding:
Executed by:
  • tst_QPrinter
1
202 d->embedFonts = value.toBool();-
203 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
204 case PPK_Duplex:
executed 2 times by 1 test: case PPK_Duplex:
Executed by:
  • tst_QPrinter
2
205 d->duplex = static_cast<QPrint::DuplexMode>(value.toInt());-
206 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
207 case PPK_CustomPaperSize:
never executed: case PPK_CustomPaperSize:
0
208 d->m_pageLayout.setPageSize(QPageSize(value.toSizeF(), QPageSize::Point));-
209 break;
never executed: break;
0
210 case PPK_PageMargins: {
never executed: case PPK_PageMargins:
0
211 QList<QVariant> margins(value.toList());-
212 Q_ASSERT(margins.size() == 4);-
213 d->m_pageLayout.setUnits(QPageLayout::Point);-
214 d->m_pageLayout.setMargins(QMarginsF(margins.at(0).toReal(), margins.at(1).toReal(),-
215 margins.at(2).toReal(), margins.at(3).toReal()));-
216 break;
never executed: break;
0
217 }-
218 case PPK_QPageSize: {
executed 47 times by 1 test: case PPK_QPageSize:
Executed by:
  • tst_QPrinter
47
219 QPageSize pageSize = value.value<QPageSize>();-
220 if (pageSize.isValid())
pageSize.isValid()Description
TRUEevaluated 47 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
0-47
221 d->m_pageLayout.setPageSize(pageSize);
executed 47 times by 1 test: d->m_pageLayout.setPageSize(pageSize);
Executed by:
  • tst_QPrinter
47
222 break;
executed 47 times by 1 test: break;
Executed by:
  • tst_QPrinter
47
223 }-
224 case PPK_QPageMargins: {
executed 13 times by 1 test: case PPK_QPageMargins:
Executed by:
  • tst_QPrinter
13
225 QPair<QMarginsF, QPageLayout::Unit> pair = value.value<QPair<QMarginsF, QPageLayout::Unit> >();-
226 d->m_pageLayout.setUnits(pair.second);-
227 d->m_pageLayout.setMargins(pair.first);-
228 break;
executed 13 times by 1 test: break;
Executed by:
  • tst_QPrinter
13
229 }-
230 case PPK_QPageLayout: {
never executed: case PPK_QPageLayout:
0
231 QPageLayout pageLayout = value.value<QPageLayout>();-
232 if (pageLayout.isValid())
pageLayout.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
0
233 d->m_pageLayout = pageLayout;
never executed: d->m_pageLayout = pageLayout;
0
234 break;
never executed: break;
0
235 }-
236 // No default so that compiler will complain if new keys added and not handled in this engine-
237 }-
238}
executed 336 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
336
239-
240QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const-
241{-
242 Q_D(const QPdfPrintEngine);-
243-
244 QVariant ret;-
245 switch (int(key)) {-
246-
247 // The following keys are settings that are unsupported by the PDF PrintEngine-
248 // Return sensible default values to ensure consistent behavior across platforms-
249 case PPK_CustomBase:
never executed: case PPK_CustomBase:
0
250 // Special case, leave null-
251 break;
never executed: break;
0
252-
253 // The following keys are properties and settings that are supported by the PDF PrintEngine-
254 case PPK_CollateCopies:
executed 6 times by 1 test: case PPK_CollateCopies:
Executed by:
  • tst_QPrinter
6
255 ret = d->collate;-
256 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QPrinter
6
257 case PPK_ColorMode:
executed 6 times by 1 test: case PPK_ColorMode:
Executed by:
  • tst_QPrinter
6
258 ret = d->grayscale ? QPrinter::GrayScale : QPrinter::Color;
d->grayscaleDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QPrinter
1-5
259 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QPrinter
6
260 case PPK_Creator:
executed 2 times by 1 test: case PPK_Creator:
Executed by:
  • tst_QPrinter
2
261 ret = d->creator;-
262 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
263 case PPK_DocumentName:
executed 6 times by 1 test: case PPK_DocumentName:
Executed by:
  • tst_QPrinter
6
264 ret = d->title;-
265 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QPrinter
6
266 case PPK_FullPage:
executed 3 times by 1 test: case PPK_FullPage:
Executed by:
  • tst_QPrinter
3
267 ret = d->m_pageLayout.mode() == QPageLayout::FullPageMode;-
268 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QPrinter
3
269 case PPK_CopyCount:
executed 10 times by 1 test: case PPK_CopyCount:
Executed by:
  • tst_QPrinter
10
270 ret = d->copies;-
271 break;
executed 10 times by 1 test: break;
Executed by:
  • tst_QPrinter
10
272 case PPK_SupportsMultipleCopies:
executed 1 time by 1 test: case PPK_SupportsMultipleCopies:
Executed by:
  • tst_QPrinter
1
273 ret = false;-
274 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
275 case PPK_NumberOfCopies:
executed 3 times by 1 test: case PPK_NumberOfCopies:
Executed by:
  • tst_QPrinter
3
276 ret = d->copies;-
277 break;
executed 3 times by 1 test: break;
Executed by:
  • tst_QPrinter
3
278 case PPK_Orientation:
never executed: case PPK_Orientation:
0
279 ret = d->m_pageLayout.orientation();-
280 break;
never executed: break;
0
281 case PPK_OutputFileName:
executed 5 times by 1 test: case PPK_OutputFileName:
Executed by:
  • tst_QPrinter
5
282 ret = d->outputFileName;-
283 break;
executed 5 times by 1 test: break;
Executed by:
  • tst_QPrinter
5
284 case PPK_PageOrder:
executed 6 times by 1 test: case PPK_PageOrder:
Executed by:
  • tst_QPrinter
6
285 ret = d->pageOrder;-
286 break;
executed 6 times by 1 test: break;
Executed by:
  • tst_QPrinter
6
287 case PPK_PageSize:
never executed: case PPK_PageSize:
0
288 ret = d->m_pageLayout.pageSize().id();-
289 break;
never executed: break;
0
290 case PPK_PaperName:
never executed: case PPK_PaperName:
0
291 ret = d->m_pageLayout.pageSize().name();-
292 break;
never executed: break;
0
293 case PPK_WindowsPageSize:
executed 2 times by 1 test: case PPK_WindowsPageSize:
Executed by:
  • tst_QPrinter
2
294 ret = d->m_pageLayout.pageSize().windowsId();-
295 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
296 case PPK_PaperSource:
executed 2 times by 1 test: case PPK_PaperSource:
Executed by:
  • tst_QPrinter
2
297 ret = d->paperSource;-
298 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
299 case PPK_PrinterName:
executed 15 times by 1 test: case PPK_PrinterName:
Executed by:
  • tst_QPrinter
15
300 ret = d->printerName;-
301 break;
executed 15 times by 1 test: break;
Executed by:
  • tst_QPrinter
15
302 case PPK_PrinterProgram:
executed 2 times by 1 test: case PPK_PrinterProgram:
Executed by:
  • tst_QPrinter
2
303 ret = d->printProgram;-
304 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
305 case PPK_Resolution:
executed 110 times by 1 test: case PPK_Resolution:
Executed by:
  • tst_QPrinter
110
306 ret = d->resolution;-
307 break;
executed 110 times by 1 test: break;
Executed by:
  • tst_QPrinter
110
308 case PPK_SupportedResolutions:
executed 1 time by 1 test: case PPK_SupportedResolutions:
Executed by:
  • tst_QPrinter
1
309 ret = QList<QVariant>() << 72;-
310 break;
executed 1 time by 1 test: break;
Executed by:
  • tst_QPrinter
1
311 case PPK_PaperRect:
executed 78 times by 1 test: case PPK_PaperRect:
Executed by:
  • tst_QPrinter
78
312 ret = d->m_pageLayout.fullRectPixels(d->resolution);-
313 break;
executed 78 times by 1 test: break;
Executed by:
  • tst_QPrinter
78
314 case PPK_PageRect:
executed 24 times by 1 test: case PPK_PageRect:
Executed by:
  • tst_QPrinter
24
315 ret = d->m_pageLayout.paintRectPixels(d->resolution);-
316 break;
executed 24 times by 1 test: break;
Executed by:
  • tst_QPrinter
24
317 case PPK_SelectionOption:
executed 2 times by 1 test: case PPK_SelectionOption:
Executed by:
  • tst_QPrinter
2
318 ret = d->selectionOption;-
319 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
320 case PPK_FontEmbedding:
executed 2 times by 1 test: case PPK_FontEmbedding:
Executed by:
  • tst_QPrinter
2
321 ret = d->embedFonts;-
322 break;
executed 2 times by 1 test: break;
Executed by:
  • tst_QPrinter
2
323 case PPK_Duplex:
executed 8 times by 1 test: case PPK_Duplex:
Executed by:
  • tst_QPrinter
8
324 ret = d->duplex;-
325 break;
executed 8 times by 1 test: break;
Executed by:
  • tst_QPrinter
8
326 case PPK_CustomPaperSize:
never executed: case PPK_CustomPaperSize:
0
327 ret = d->m_pageLayout.fullRectPoints().size();-
328 break;
never executed: break;
0
329 case PPK_PageMargins: {
never executed: case PPK_PageMargins:
0
330 QList<QVariant> list;-
331 QMarginsF margins = d->m_pageLayout.margins(QPageLayout::Point);-
332 list << margins.left() << margins.top() << margins.right() << margins.bottom();-
333 ret = list;-
334 break;
never executed: break;
0
335 }-
336 case PPK_QPageSize:
never executed: case PPK_QPageSize:
0
337 ret.setValue(d->m_pageLayout.pageSize());-
338 break;
never executed: break;
0
339 case PPK_QPageMargins: {
never executed: case PPK_QPageMargins:
0
340 QPair<QMarginsF, QPageLayout::Unit> pair = qMakePair(d->m_pageLayout.margins(), d->m_pageLayout.units());-
341 ret.setValue(pair);-
342 break;
never executed: break;
0
343 }-
344 case PPK_QPageLayout:
executed 462 times by 1 test: case PPK_QPageLayout:
Executed by:
  • tst_QPrinter
462
345 ret.setValue(d->m_pageLayout);-
346 break;
executed 462 times by 1 test: break;
Executed by:
  • tst_QPrinter
462
347 // No default so that compiler will complain if new keys added and not handled in this engine-
348 }-
349 return ret;
executed 756 times by 1 test: return ret;
Executed by:
  • tst_QPrinter
756
350}-
351-
352-
353bool QPdfPrintEnginePrivate::openPrintDevice()-
354{-
355 if (outDevice)
outDeviceDescription
TRUEnever evaluated
FALSEevaluated 21 times by 1 test
Evaluated by:
  • tst_QPrinter
0-21
356 return false;
never executed: return false;
0
357-
358 if (!outputFileName.isEmpty()) {
!outputFileName.isEmpty()Description
TRUEevaluated 21 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
0-21
359 QFile *file = new QFile(outputFileName);-
360 if (! file->open(QFile::WriteOnly|QFile::Truncate)) {
! file->open(Q...ile::Truncate)Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QPrinter
1-20
361 delete file;-
362 return false;
executed 1 time by 1 test: return false;
Executed by:
  • tst_QPrinter
1
363 }-
364 outDevice = file;-
365 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_QPrinter
20
366-
367 return true;
executed 20 times by 1 test: return true;
Executed by:
  • tst_QPrinter
20
368}-
369-
370void QPdfPrintEnginePrivate::closePrintDevice()-
371{-
372 if (outDevice) {
outDeviceDescription
TRUEevaluated 20 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
0-20
373 outDevice->close();-
374 if (fd >= 0)
fd >= 0Description
TRUEnever evaluated
FALSEevaluated 20 times by 1 test
Evaluated by:
  • tst_QPrinter
0-20
375 #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400-
376 ::_close(fd);-
377 #else-
378 ::close(fd);
never executed: ::close(fd);
0
379 #endif-
380 fd = -1;-
381 delete outDevice;-
382 outDevice = 0;-
383 }
executed 20 times by 1 test: end of block
Executed by:
  • tst_QPrinter
20
384}
executed 20 times by 1 test: end of block
Executed by:
  • tst_QPrinter
20
385-
386-
387-
388QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m)-
389 : QPdfEnginePrivate(),-
390 duplex(QPrint::DuplexNone),-
391 collate(true),-
392 copies(1),-
393 pageOrder(QPrinter::FirstPageFirst),-
394 paperSource(QPrinter::Auto),-
395 fd(-1)-
396{-
397 resolution = 72;-
398 if (m == QPrinter::HighResolution)
m == QPrinter::HighResolutionDescription
TRUEevaluated 32 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 96 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
32-96
399 resolution = 1200;
executed 32 times by 1 test: resolution = 1200;
Executed by:
  • tst_QPrinter
32
400 else if (m == QPrinter::ScreenResolution)
m == QPrinter:...reenResolutionDescription
TRUEevaluated 92 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
4-92
401 resolution = qt_defaultDpi();
executed 92 times by 2 tests: resolution = qt_defaultDpi();
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
92
402}
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
403-
404QPdfPrintEnginePrivate::~QPdfPrintEnginePrivate()-
405{-
406}-
407-
408QT_END_NAMESPACE-
409-
410#endif // QT_NO_PRINTER-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9