qprinter.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qprinter.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7-
8-
9-
10extern qreal qt_pixelMultiplier(int resolution);-
11extern QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits);-
12-
13-
14__attribute__((visibility("default"))) double qt_multiplierForUnit(QPrinter::Unit unit, int resolution)-
15{-
16 switch(unit) {-
17 case
never executed: case QPrinter::Millimeter:
QPrinter::Millimeter:
never executed: case QPrinter::Millimeter:
0
18 return
never executed: return 2.83464566929;
2.83464566929;
never executed: return 2.83464566929;
0
19 case
never executed: case QPrinter::Point:
QPrinter::Point:
never executed: case QPrinter::Point:
0
20 return
never executed: return 1.0;
1.0;
never executed: return 1.0;
0
21 case
never executed: case QPrinter::Inch:
QPrinter::Inch:
never executed: case QPrinter::Inch:
0
22 return
never executed: return 72.0;
72.0;
never executed: return 72.0;
0
23 case
never executed: case QPrinter::Pica:
QPrinter::Pica:
never executed: case QPrinter::Pica:
0
24 return
never executed: return 12;
12;
never executed: return 12;
0
25 case
never executed: case QPrinter::Didot:
QPrinter::Didot:
never executed: case QPrinter::Didot:
0
26 return
never executed: return 1.065826771;
1.065826771;
never executed: return 1.065826771;
0
27 case
never executed: case QPrinter::Cicero:
QPrinter::Cicero:
never executed: case QPrinter::Cicero:
0
28 return
never executed: return 12.789921252;
12.789921252;
never executed: return 12.789921252;
0
29 case
never executed: case QPrinter::DevicePixel:
QPrinter::DevicePixel:
never executed: case QPrinter::DevicePixel:
0
30 return
never executed: return 72.0/resolution;
72.0/resolution;
never executed: return 72.0/resolution;
0
31 }-
32 return
never executed: return 1.0;
1.0;
never executed: return 1.0;
0
33}-
34-
35-
36__attribute__((visibility("default"))) QSizeF qt_printerPaperSize(QPrinter::Orientation orientation,-
37 QPrinter::PaperSize paperSize,-
38 QPrinter::Unit unit,-
39 int resolution)-
40{-
41 QPageSize pageSize = QPageSize(QPageSize::PageSizeId(paperSize));-
42 QSizeF sizef;-
43 if (unit == QPrinter::DevicePixel
unit == QPrinter::DevicePixelDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
44 sizef = pageSize.size(QPageSize::Point) * qt_multiplierForUnit(unit, resolution);
never executed: sizef = pageSize.size(QPageSize::Point) * qt_multiplierForUnit(unit, resolution);
0
45 else-
46 sizef = pageSize.size(QPageSize::Unit(unit));
never executed: sizef = pageSize.size(QPageSize::Unit(unit));
0
47 return
never executed: return orientation == QPrinter::Landscape ? sizef.transposed() : sizef;
orientation == QPrinter::Landscape ? sizef.transposed() : sizef;
never executed: return orientation == QPrinter::Landscape ? sizef.transposed() : sizef;
0
48}-
49-
50QPrinterInfo QPrinterPrivate::findValidPrinter(const QPrinterInfo &printer)-
51{-
52-
53 QPrinterInfo printerToUse = printer;-
54 if (printerToUse.isNull()
printerToUse.isNull()Description
TRUEevaluated 134 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
FALSEnever evaluated
) {
0-134
55 printerToUse = QPrinterInfo::defaultPrinter();-
56 if (printerToUse.isNull()
printerToUse.isNull()Description
TRUEevaluated 134 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
FALSEnever evaluated
) {
0-134
57 QStringList availablePrinterNames = QPrinterInfo::availablePrinterNames();-
58 if (!availablePrinterNames.isEmpty()
!availablePrin...ames.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 134 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
)
0-134
59 printerToUse = QPrinterInfo::printerInfo(availablePrinterNames.at(0));
never executed: printerToUse = QPrinterInfo::printerInfo(availablePrinterNames.at(0));
0
60 }
executed 134 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
134
61 }
executed 134 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
134
62 return
executed 134 times by 2 tests: return printerToUse;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
printerToUse;
executed 134 times by 2 tests: return printerToUse;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
134
63}-
64-
65void QPrinterPrivate::initEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer)-
66{-
67-
68 outputFormat = QPrinter::PdfFormat;-
69 QPlatformPrinterSupport *ps = 0;-
70 QString printerName;-
71-
72-
73 if (format == QPrinter::NativeFormat
format == QPri...::NativeFormatDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
FALSEnever evaluated
) {
0-128
74 ps = QPlatformPrinterSupportPlugin::get();-
75 QPrinterInfo printerToUse = findValidPrinter(printer);-
76 if (ps
psDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
FALSEnever evaluated
&& !printerToUse.isNull()
!printerToUse.isNull()Description
TRUEnever evaluated
FALSEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
) {
0-128
77 outputFormat = QPrinter::NativeFormat;-
78 printerName = printerToUse.printerName();-
79 }
never executed: end of block
0
80 }
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
81-
82 if (outputFormat == QPrinter::NativeFormat
outputFormat =...::NativeFormatDescription
TRUEnever evaluated
FALSEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
) {
0-128
83 printEngine = ps->createNativePrintEngine(printerMode);-
84 paintEngine = ps->createPaintEngine(printEngine, printerMode);-
85 }
never executed: end of block
else {
0
86 QPdfPrintEngine *pdfEngine = new QPdfPrintEngine(printerMode);-
87 paintEngine = pdfEngine;-
88 printEngine = pdfEngine;-
89 }
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
90-
91 use_default_engine = true;-
92 had_default_engines = true;-
93 setProperty(QPrintEngine::PPK_PrinterName, printerName);-
94 validPrinter = true;-
95}
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
96-
97void QPrinterPrivate::changeEngines(QPrinter::OutputFormat format, const QPrinterInfo &printer)-
98{-
99 QPrintEngine *oldPrintEngine = printEngine;-
100 const bool def_engine = use_default_engine;-
101-
102 initEngines(format, printer);-
103-
104 if (oldPrintEngine
oldPrintEngineDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
105 const auto properties = m_properties;-
106 for (const auto &key : properties) {-
107 QVariant prop;-
108-
109-
110-
111 if (key == QPrintEngine::PPK_NumberOfCopies
key == QPrintE...NumberOfCopiesDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
112 prop = QVariant(q_ptr->copyCount());
never executed: prop = QVariant(q_ptr->copyCount());
0
113 else if (key != QPrintEngine::PPK_PrinterName
key != QPrintE...PK_PrinterNameDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
114 prop = oldPrintEngine->property(key);
never executed: prop = oldPrintEngine->property(key);
0
115 if (prop.isValid()
prop.isValid()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
116 setProperty(key, prop);
never executed: setProperty(key, prop);
0
117 }
never executed: end of block
0
118 }
never executed: end of block
0
119-
120 if (def_engine
def_engineDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
121 delete oldPrintEngine;
never executed: delete oldPrintEngine;
0
122}
never executed: end of block
0
123-
124-
125QList<const QPicture *> QPrinterPrivate::previewPages() const-
126{-
127 if (previewEngine
previewEngineDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
128 return
executed 1 time by 1 test: return previewEngine->pages();
Executed by:
  • tst_QPrinter
previewEngine->pages();
executed 1 time by 1 test: return previewEngine->pages();
Executed by:
  • tst_QPrinter
1
129 return
never executed: return QList<const QPicture *>();
QList<const QPicture *>();
never executed: return QList<const QPicture *>();
0
130}-
131-
132void QPrinterPrivate::setPreviewMode(bool enable)-
133{-
134 QPrinter * const q = q_func();-
135 if (enable
enableDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) {
1
136 if (!previewEngine
!previewEngineDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
137 previewEngine = new QPreviewPaintEngine;
executed 1 time by 1 test: previewEngine = new QPreviewPaintEngine;
Executed by:
  • tst_QPrinter
1
138 had_default_engines = use_default_engine;-
139 use_default_engine = false;-
140 realPrintEngine = printEngine;-
141 realPaintEngine = paintEngine;-
142 q->setEngines(previewEngine, previewEngine);-
143 previewEngine->setProxyEngines(realPrintEngine, realPaintEngine);-
144 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
else {
1
145 q->setEngines(realPrintEngine, realPaintEngine);-
146 use_default_engine = had_default_engines;-
147 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
148}-
149-
150-
151void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value)-
152{-
153 printEngine->setProperty(key, value);-
154 m_properties.insert(key);-
155}
executed 336 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
336
156-
157-
158class QPrinterPagedPaintDevicePrivate : public QPagedPaintDevicePrivate-
159{-
160public:-
161 QPrinterPagedPaintDevicePrivate(QPrinterPrivate *d)-
162 : QPagedPaintDevicePrivate(), pd(d)-
163 {}
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
164-
165 virtual ~QPrinterPagedPaintDevicePrivate()-
166 {}-
167-
168 bool setPageLayout(const QPageLayout &newPageLayout) override-
169 {-
170 if (pd->paintEngine->type() != QPaintEngine::Pdf
pd->paintEngin...intEngine::PdfDescription
TRUEnever evaluated
FALSEnever evaluated
0
171 && pd->printEngine->printerState() == QPrinter::Active
pd->printEngin...rinter::ActiveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
172 QMessageLogger(__FILE__, 236, __PRETTY_FUNCTION__).warning("QPrinter::setPageLayout: Cannot be changed while printer is active");-
173 return
never executed: return false;
false;
never executed: return false;
0
174 }-
175-
176-
177 pd->setProperty(QPrintEngine::PPK_QPageLayout, QVariant::fromValue(newPageLayout));-
178-
179-
180 m_pageLayout = pageLayout();-
181-
182 return
never executed: return pageLayout().isEquivalentTo(newPageLayout);
pageLayout().isEquivalentTo(newPageLayout);
never executed: return pageLayout().isEquivalentTo(newPageLayout);
0
183 }-
184-
185 bool setPageSize(const QPageSize &pageSize) override-
186 {-
187 if (pd->paintEngine->type() != QPaintEngine::Pdf
pd->paintEngin...intEngine::PdfDescription
TRUEnever evaluated
FALSEevaluated 47 times by 1 test
Evaluated by:
  • tst_QPrinter
0-47
188 && pd->printEngine->printerState() == QPrinter::Active
pd->printEngin...rinter::ActiveDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
189 QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__).warning("QPrinter::setPageLayout: Cannot be changed while printer is active");-
190 return
never executed: return false;
false;
never executed: return false;
0
191 }-
192-
193-
194-
195 pd->setProperty(QPrintEngine::PPK_QPageSize, QVariant::fromValue(pageSize));-
196-
197-
198 m_pageLayout = pageLayout();-
199-
200 return
executed 47 times by 1 test: return pageLayout().pageSize().isEquivalentTo(pageSize);
Executed by:
  • tst_QPrinter
pageLayout().pageSize().isEquivalentTo(pageSize);
executed 47 times by 1 test: return pageLayout().pageSize().isEquivalentTo(pageSize);
Executed by:
  • tst_QPrinter
47
201 }-
202-
203 bool setPageOrientation(QPageLayout::Orientation orientation) override-
204 {-
205-
206 pd->setProperty(QPrintEngine::PPK_Orientation, orientation);-
207-
208-
209 m_pageLayout = pageLayout();-
210-
211 return
executed 48 times by 1 test: return pageLayout().orientation() == orientation;
Executed by:
  • tst_QPrinter
pageLayout().orientation() == orientation;
executed 48 times by 1 test: return pageLayout().orientation() == orientation;
Executed by:
  • tst_QPrinter
48
212 }-
213-
214 bool setPageMargins(const QMarginsF &margins) override-
215 {-
216 return
never executed: return setPageMargins(margins, pageLayout().units());
setPageMargins(margins, pageLayout().units());
never executed: return setPageMargins(margins, pageLayout().units());
0
217 }-
218-
219 bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override-
220 {-
221-
222 QPair<QMarginsF, QPageLayout::Unit> pair = qMakePair(margins, units);-
223 pd->setProperty(QPrintEngine::PPK_QPageMargins, QVariant::fromValue(pair));-
224-
225-
226 m_pageLayout = pageLayout();-
227-
228 return
executed 13 times by 1 test: return pageLayout().margins() == margins && pageLayout().units() == units;
Executed by:
  • tst_QPrinter
pageLayout().margins() == margins && pageLayout().units() == units;
executed 13 times by 1 test: return pageLayout().margins() == margins && pageLayout().units() == units;
Executed by:
  • tst_QPrinter
13
229 }-
230-
231 QPageLayout pageLayout() const override-
232 {-
233 return
executed 462 times by 1 test: return pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value<QPageLayout>();
Executed by:
  • tst_QPrinter
pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value<QPageLayout>();
executed 462 times by 1 test: return pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value<QPageLayout>();
Executed by:
  • tst_QPrinter
462
234 }-
235-
236 QPrinterPrivate *pd;-
237};-
238QPrinter::QPrinter(PrinterMode mode)-
239 : QPagedPaintDevice(),-
240 d_ptr(new QPrinterPrivate(this))-
241{-
242 delete d;-
243 d = new QPrinterPagedPaintDevicePrivate(d_func());-
244 d_ptr->init(QPrinterInfo(), mode);-
245}
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
246-
247-
248-
249-
250-
251-
252QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode)-
253 : QPagedPaintDevice(),-
254 d_ptr(new QPrinterPrivate(this))-
255{-
256 delete d;-
257 d = new QPrinterPagedPaintDevicePrivate(d_func());-
258 d_ptr->init(printer, mode);-
259}
never executed: end of block
0
260-
261void QPrinterPrivate::init(const QPrinterInfo &printer, QPrinter::PrinterMode mode)-
262{-
263 if (__builtin_expect(!!(!QCoreApplication::instance()), false)
__builtin_expe...nce()), false)Description
TRUEnever evaluated
FALSEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
) {
0-128
264 QMessageLogger(__FILE__, 706, __PRETTY_FUNCTION__).fatal("QPrinter: Must construct a QCoreApplication before a QPrinter");-
265 return;
never executed: return;
0
266 }-
267-
268 printerMode = mode;-
269-
270 initEngines(QPrinter::NativeFormat, printer);-
271}
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
272void QPrinter::setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine)-
273{-
274 QPrinterPrivate * const d = d_func();-
275-
276 if (d->use_default_engine
d->use_default_engineDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-2
277 delete d->printEngine;
never executed: delete d->printEngine;
0
278-
279 d->printEngine = printEngine;-
280 d->paintEngine = paintEngine;-
281 d->use_default_engine = false;-
282}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QPrinter
2
283-
284-
285-
286-
287-
288-
289QPrinter::~QPrinter()-
290{-
291 QPrinterPrivate * const d = d_func();-
292 if (d->use_default_engine
d->use_default_engineDescription
TRUEevaluated 128 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
FALSEnever evaluated
)
0-128
293 delete d->printEngine;
executed 128 times by 2 tests: delete d->printEngine;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
294-
295 delete d->previewEngine;-
296-
297}
executed 128 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
128
298void QPrinter::setOutputFormat(OutputFormat format)-
299{-
300 QPrinterPrivate * const d = d_func();-
301-
302 if (d->outputFormat == format
d->outputFormat == formatDescription
TRUEevaluated 40 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QPrinter
)
6-40
303 return;
executed 40 times by 1 test: return;
Executed by:
  • tst_QPrinter
40
304-
305 if (format == QPrinter::NativeFormat
format == QPri...::NativeFormatDescription
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
) {
0-6
306 QPrinterInfo printerToUse = d->findValidPrinter();-
307 if (!printerToUse.isNull()
!printerToUse.isNull()Description
TRUEnever evaluated
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-6
308 d->changeEngines(format, printerToUse);
never executed: d->changeEngines(format, printerToUse);
0
309 }
executed 6 times by 1 test: end of block
Executed by:
  • tst_QPrinter
else {
6
310 d->changeEngines(format, QPrinterInfo());-
311 }
never executed: end of block
0
312}-
313-
314-
315-
316-
317-
318-
319QPrinter::OutputFormat QPrinter::outputFormat() const-
320{-
321 const QPrinterPrivate * const d = d_func();-
322 return
executed 48 times by 1 test: return d->outputFormat;
Executed by:
  • tst_QPrinter
d->outputFormat;
executed 48 times by 1 test: return d->outputFormat;
Executed by:
  • tst_QPrinter
48
323}-
324-
325-
326-
327-
328-
329int QPrinter::devType() const-
330{-
331 return
executed 108 times by 1 test: return QInternal::Printer;
Executed by:
  • tst_QPrinter
QInternal::Printer;
executed 108 times by 1 test: return QInternal::Printer;
Executed by:
  • tst_QPrinter
108
332}-
333-
334-
335-
336-
337-
338-
339-
340QString QPrinter::printerName() const-
341{-
342 const QPrinterPrivate * const d = d_func();-
343 return
executed 15 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PrinterName).toString();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_PrinterName).toString();
executed 15 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PrinterName).toString();
Executed by:
  • tst_QPrinter
15
344}-
345void QPrinter::setPrinterName(const QString &name)-
346{-
347 QPrinterPrivate * const d = d_func();-
348 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 5 times by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 849, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setPrinterName"); return;
never executed: return;
};
0-5
349-
350 if (printerName() == name
printerName() == nameDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
)
1-4
351 return;
executed 4 times by 1 test: return;
Executed by:
  • tst_QPrinter
4
352-
353 if (name.isEmpty()
name.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) {
0-1
354 setOutputFormat(QPrinter::PdfFormat);-
355 return;
never executed: return;
0
356 }-
357-
358 QPrinterInfo printerToUse = QPrinterInfo::printerInfo(name);-
359 if (printerToUse.isNull()
printerToUse.isNull()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
360 return;
executed 1 time by 1 test: return;
Executed by:
  • tst_QPrinter
1
361-
362 if (outputFormat() == QPrinter::PdfFormat
outputFormat()...ter::PdfFormatDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
363 d->changeEngines(QPrinter::NativeFormat, printerToUse);-
364 }
never executed: end of block
else {
0
365 d->setProperty(QPrintEngine::PPK_PrinterName, name);-
366 }
never executed: end of block
0
367}-
368bool QPrinter::isValid() const-
369{-
370 const QPrinterPrivate * const d = d_func();-
371 if (!QCoreApplication::instance()
!QCoreApplication::instance()Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-3
372 return
never executed: return false;
false;
never executed: return false;
0
373 return
executed 3 times by 1 test: return d->validPrinter;
Executed by:
  • tst_QPrinter
d->validPrinter;
executed 3 times by 1 test: return d->validPrinter;
Executed by:
  • tst_QPrinter
3
374}-
375QString QPrinter::outputFileName() const-
376{-
377 const QPrinterPrivate * const d = d_func();-
378 return
executed 5 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_OutputFileName).toString();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_OutputFileName).toString();
executed 5 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_OutputFileName).toString();
Executed by:
  • tst_QPrinter
5
379}-
380void QPrinter::setOutputFileName(const QString &fileName)-
381{-
382 QPrinterPrivate * const d = d_func();-
383 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 39 times by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 928, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setOutputFileName"); return;
never executed: return;
};
0-39
384-
385 QFileInfo fi(fileName);-
386 if (!fi.suffix().compare(QLatin1String("pdf"), Qt::CaseInsensitive)
!fi.suffix().c...seInsensitive)Description
TRUEevaluated 6 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 33 times by 1 test
Evaluated by:
  • tst_QPrinter
)
6-33
387 setOutputFormat(QPrinter::PdfFormat);
executed 6 times by 1 test: setOutputFormat(QPrinter::PdfFormat);
Executed by:
  • tst_QPrinter
6
388 else if (fileName.isEmpty()
fileName.isEmpty()Description
TRUEnever evaluated
FALSEevaluated 33 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-33
389 setOutputFormat(QPrinter::NativeFormat);
never executed: setOutputFormat(QPrinter::NativeFormat);
0
390-
391 d->setProperty(QPrintEngine::PPK_OutputFileName, fileName);-
392}
executed 39 times by 1 test: end of block
Executed by:
  • tst_QPrinter
39
393QString QPrinter::printProgram() const-
394{-
395 const QPrinterPrivate * const d = d_func();-
396 return
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PrinterProgram).toString();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_PrinterProgram).toString();
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PrinterProgram).toString();
Executed by:
  • tst_QPrinter
2
397}-
398void QPrinter::setPrintProgram(const QString &printProg)-
399{-
400 QPrinterPrivate * const d = d_func();-
401 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 970, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setPrintProgram"); return;
never executed: return;
};
0-1
402 d->setProperty(QPrintEngine::PPK_PrinterProgram, printProg);-
403}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
404-
405-
406-
407-
408-
409-
410-
411QString QPrinter::docName() const-
412{-
413 const QPrinterPrivate * const d = d_func();-
414 return
executed 6 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_DocumentName).toString();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_DocumentName).toString();
executed 6 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_DocumentName).toString();
Executed by:
  • tst_QPrinter
6
415}-
416void QPrinter::setDocName(const QString &name)-
417{-
418 QPrinterPrivate * const d = d_func();-
419 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1000, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setDocName"); return;
never executed: return;
};
0-2
420 d->setProperty(QPrintEngine::PPK_DocumentName, name);-
421}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QPrinter
2
422-
423-
424-
425-
426-
427-
428-
429QString QPrinter::creator() const-
430{-
431 const QPrinterPrivate * const d = d_func();-
432 return
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_Creator).toString();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_Creator).toString();
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_Creator).toString();
Executed by:
  • tst_QPrinter
2
433}-
434void QPrinter::setCreator(const QString &creator)-
435{-
436 QPrinterPrivate * const d = d_func();-
437 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1030, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setCreator"); return;
never executed: return;
};
0-1
438 d->setProperty(QPrintEngine::PPK_Creator, creator);-
439}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
440QPrinter::Orientation QPrinter::orientation() const-
441{-
442 return
executed 75 times by 1 test: return QPrinter::Orientation(pageLayout().orientation());
Executed by:
  • tst_QPrinter
QPrinter::Orientation(pageLayout().orientation());
executed 75 times by 1 test: return QPrinter::Orientation(pageLayout().orientation());
Executed by:
  • tst_QPrinter
75
443}-
444void QPrinter::setOrientation(Orientation orientation)-
445{-
446 setPageOrientation(QPageLayout::Orientation(orientation));-
447}
executed 48 times by 1 test: end of block
Executed by:
  • tst_QPrinter
48
448QPrinter::PaperSize QPrinter::paperSize() const-
449{-
450 return
executed 2 times by 1 test: return pageSize();
Executed by:
  • tst_QPrinter
pageSize();
executed 2 times by 1 test: return pageSize();
Executed by:
  • tst_QPrinter
2
451}-
452void QPrinter::setPaperSize(PaperSize newPaperSize)-
453{-
454 setPageSize(QPageSize(QPageSize::PageSizeId(newPaperSize)));-
455}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
456QPrinter::PageSize QPrinter::pageSize() const-
457{-
458 return
executed 31 times by 1 test: return QPrinter::PaperSize(pageLayout().pageSize().id());
Executed by:
  • tst_QPrinter
QPrinter::PaperSize(pageLayout().pageSize().id());
executed 31 times by 1 test: return QPrinter::PaperSize(pageLayout().pageSize().id());
Executed by:
  • tst_QPrinter
31
459}-
460void QPrinter::setPageSize(PageSize newPageSize)-
461{-
462 setPageSize(QPageSize(QPageSize::PageSizeId(newPageSize)));-
463}
executed 31 times by 1 test: end of block
Executed by:
  • tst_QPrinter
31
464void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit)-
465{-
466 if (unit == QPrinter::DevicePixel
unit == QPrinter::DevicePixelDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QPrinter
)
1-6
467 setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point));
executed 1 time by 1 test: setPageSize(QPageSize(paperSize * qt_pixelMultiplier(resolution()), QPageSize::Point));
Executed by:
  • tst_QPrinter
1
468 else-
469 setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
executed 6 times by 1 test: setPageSize(QPageSize(paperSize, QPageSize::Unit(unit)));
Executed by:
  • tst_QPrinter
6
470}-
471void QPrinter::setPageSizeMM(const QSizeF &size)-
472{-
473 setPageSize(QPageSize(size, QPageSize::Millimeter));-
474}
executed 8 times by 1 test: end of block
Executed by:
  • tst_QPrinter
8
475QSizeF QPrinter::paperSize(Unit unit) const-
476{-
477 if (unit == QPrinter::DevicePixel
unit == QPrinter::DevicePixelDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 21 times by 1 test
Evaluated by:
  • tst_QPrinter
)
1-21
478 return
executed 1 time by 1 test: return pageLayout().fullRectPixels(resolution()).size();
Executed by:
  • tst_QPrinter
pageLayout().fullRectPixels(resolution()).size();
executed 1 time by 1 test: return pageLayout().fullRectPixels(resolution()).size();
Executed by:
  • tst_QPrinter
1
479 else-
480 return
executed 21 times by 1 test: return pageLayout().fullRect(QPageLayout::Unit(unit)).size();
Executed by:
  • tst_QPrinter
pageLayout().fullRect(QPageLayout::Unit(unit)).size();
executed 21 times by 1 test: return pageLayout().fullRect(QPageLayout::Unit(unit)).size();
Executed by:
  • tst_QPrinter
21
481}-
482void QPrinter::setPaperName(const QString &paperName)-
483{-
484 QPrinterPrivate * const d = d_func();-
485 if (d->paintEngine->type() != QPaintEngine::Pdf
d->paintEngine...intEngine::PdfDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
486 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEnever evaluated
) { QMessageLogger(__FILE__, 1300, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setPaperName"); return;
never executed: return;
};
0
487 d->setProperty(QPrintEngine::PPK_PaperName, paperName);-
488}
never executed: end of block
0
489QString QPrinter::paperName() const-
490{-
491 const QPrinterPrivate * const d = d_func();-
492 return
never executed: return d->printEngine->property(QPrintEngine::PPK_PaperName).toString();
d->printEngine->property(QPrintEngine::PPK_PaperName).toString();
never executed: return d->printEngine->property(QPrintEngine::PPK_PaperName).toString();
0
493}-
494void QPrinter::setPageOrder(PageOrder pageOrder)-
495{-
496 d->pageOrderAscending = (pageOrder == FirstPageFirst);-
497-
498 QPrinterPrivate * const d = d_func();-
499 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1340, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setPageOrder"); return;
never executed: return;
};
0-1
500 d->setProperty(QPrintEngine::PPK_PageOrder, pageOrder);-
501}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
502QPrinter::PageOrder QPrinter::pageOrder() const-
503{-
504 const QPrinterPrivate * const d = d_func();-
505 return
executed 6 times by 1 test: return QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt());
Executed by:
  • tst_QPrinter
QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt());
executed 6 times by 1 test: return QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt());
Executed by:
  • tst_QPrinter
6
506}-
507void QPrinter::setColorMode(ColorMode newColorMode)-
508{-
509 QPrinterPrivate * const d = d_func();-
510 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1368, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setColorMode"); return;
never executed: return;
};
0-1
511 d->setProperty(QPrintEngine::PPK_ColorMode, newColorMode);-
512}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
513-
514-
515-
516-
517-
518-
519-
520QPrinter::ColorMode QPrinter::colorMode() const-
521{-
522 const QPrinterPrivate * const d = d_func();-
523 return
executed 6 times by 1 test: return QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt());
Executed by:
  • tst_QPrinter
QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt());
executed 6 times by 1 test: return QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt());
Executed by:
  • tst_QPrinter
6
524}-
525int QPrinter::numCopies() const-
526{-
527 const QPrinterPrivate * const d = d_func();-
528 return
executed 3 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt();
executed 3 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt();
Executed by:
  • tst_QPrinter
3
529}-
530int QPrinter::actualNumCopies() const-
531{-
532 return
executed 3 times by 1 test: return copyCount();
Executed by:
  • tst_QPrinter
copyCount();
executed 3 times by 1 test: return copyCount();
Executed by:
  • tst_QPrinter
3
533}-
534void QPrinter::setNumCopies(int numCopies)-
535{-
536 QPrinterPrivate * const d = d_func();-
537 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1447, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setNumCopies"); return;
never executed: return;
};
0-1
538 d->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies);-
539}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
540void QPrinter::setCopyCount(int count)-
541{-
542 QPrinterPrivate * const d = d_func();-
543 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1465, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setCopyCount;"); return;
never executed: return;
};
0-1
544 d->setProperty(QPrintEngine::PPK_CopyCount, count);-
545}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
546int QPrinter::copyCount() const-
547{-
548 const QPrinterPrivate * const d = d_func();-
549 return
executed 10 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt();
executed 10 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt();
Executed by:
  • tst_QPrinter
10
550}-
551bool QPrinter::supportsMultipleCopies() const-
552{-
553 const QPrinterPrivate * const d = d_func();-
554 return
executed 1 time by 1 test: return d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool();
executed 1 time by 1 test: return d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool();
Executed by:
  • tst_QPrinter
1
555}-
556bool QPrinter::collateCopies() const-
557{-
558 const QPrinterPrivate * const d = d_func();-
559 return
executed 6 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool();
executed 6 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool();
Executed by:
  • tst_QPrinter
6
560}-
561void QPrinter::setCollateCopies(bool collate)-
562{-
563 QPrinterPrivate * const d = d_func();-
564 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1534, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setCollateCopies"); return;
never executed: return;
};
0-1
565 d->setProperty(QPrintEngine::PPK_CollateCopies, collate);-
566}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
567void QPrinter::setFullPage(bool fp)-
568{-
569 QPrinterPrivate * const d = d_func();-
570-
571 d->setProperty(QPrintEngine::PPK_FullPage, fp);-
572-
573 devicePageLayout() = pageLayout();-
574}
executed 19 times by 1 test: end of block
Executed by:
  • tst_QPrinter
19
575bool QPrinter::fullPage() const-
576{-
577 const QPrinterPrivate * const d = d_func();-
578 return
executed 3 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_FullPage).toBool();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_FullPage).toBool();
executed 3 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_FullPage).toBool();
Executed by:
  • tst_QPrinter
3
579}-
580void QPrinter::setResolution(int dpi)-
581{-
582 QPrinterPrivate * const d = d_func();-
583 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 27 times by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1604, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setResolution"); return;
never executed: return;
};
0-27
584 d->setProperty(QPrintEngine::PPK_Resolution, dpi);-
585}
executed 27 times by 1 test: end of block
Executed by:
  • tst_QPrinter
27
586int QPrinter::resolution() const-
587{-
588 const QPrinterPrivate * const d = d_func();-
589 return
executed 110 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_Resolution).toInt();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_Resolution).toInt();
executed 110 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_Resolution).toInt();
Executed by:
  • tst_QPrinter
110
590}-
591void QPrinter::setPaperSource(PaperSource source)-
592{-
593 QPrinterPrivate * const d = d_func();-
594 d->setProperty(QPrintEngine::PPK_PaperSource, source);-
595}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
596-
597-
598-
599-
600-
601QPrinter::PaperSource QPrinter::paperSource() const-
602{-
603 const QPrinterPrivate * const d = d_func();-
604 return
executed 2 times by 1 test: return QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt());
Executed by:
  • tst_QPrinter
QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt());
executed 2 times by 1 test: return QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt());
Executed by:
  • tst_QPrinter
2
605}-
606void QPrinter::setFontEmbeddingEnabled(bool enable)-
607{-
608 QPrinterPrivate * const d = d_func();-
609 d->setProperty(QPrintEngine::PPK_FontEmbedding, enable);-
610}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
611bool QPrinter::fontEmbeddingEnabled() const-
612{-
613 const QPrinterPrivate * const d = d_func();-
614 return
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool();
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool();
Executed by:
  • tst_QPrinter
2
615}-
616void QPrinter::setDoubleSidedPrinting(bool doubleSided)-
617{-
618 setDuplex(doubleSided ? DuplexAuto : DuplexNone);-
619}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
620bool QPrinter::doubleSidedPrinting() const-
621{-
622 return
executed 2 times by 1 test: return duplex() != DuplexNone;
Executed by:
  • tst_QPrinter
duplex() != DuplexNone;
executed 2 times by 1 test: return duplex() != DuplexNone;
Executed by:
  • tst_QPrinter
2
623}-
624void QPrinter::setDuplex(DuplexMode duplex)-
625{-
626 QPrinterPrivate * const d = d_func();-
627 d->setProperty(QPrintEngine::PPK_Duplex, duplex);-
628}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QPrinter
2
629QPrinter::DuplexMode QPrinter::duplex() const-
630{-
631 const QPrinterPrivate * const d = d_func();-
632 return
executed 8 times by 1 test: return static_cast <DuplexMode> (d->printEngine->property(QPrintEngine::PPK_Duplex).toInt());
Executed by:
  • tst_QPrinter
static_cast <DuplexMode> (d->printEngine->property(QPrintEngine::PPK_Duplex).toInt());
executed 8 times by 1 test: return static_cast <DuplexMode> (d->printEngine->property(QPrintEngine::PPK_Duplex).toInt());
Executed by:
  • tst_QPrinter
8
633}-
634QRectF QPrinter::pageRect(Unit unit) const-
635{-
636 if (unit == QPrinter::DevicePixel
unit == QPrinter::DevicePixelDescription
TRUEevaluated 4 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QPrinter
)
4-18
637 return
executed 4 times by 1 test: return pageLayout().paintRectPixels(resolution());
Executed by:
  • tst_QPrinter
pageLayout().paintRectPixels(resolution());
executed 4 times by 1 test: return pageLayout().paintRectPixels(resolution());
Executed by:
  • tst_QPrinter
4
638 else-
639 return
executed 18 times by 1 test: return pageLayout().paintRect(QPageLayout::Unit(unit));
Executed by:
  • tst_QPrinter
pageLayout().paintRect(QPageLayout::Unit(unit));
executed 18 times by 1 test: return pageLayout().paintRect(QPageLayout::Unit(unit));
Executed by:
  • tst_QPrinter
18
640}-
641QRectF QPrinter::paperRect(Unit unit) const-
642{-
643 if (unit == QPrinter::DevicePixel
unit == QPrinter::DevicePixelDescription
TRUEnever evaluated
FALSEevaluated 18 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-18
644 return
never executed: return pageLayout().fullRectPixels(resolution());
pageLayout().fullRectPixels(resolution());
never executed: return pageLayout().fullRectPixels(resolution());
0
645 else-
646 return
executed 18 times by 1 test: return pageLayout().fullRect(QPageLayout::Unit(unit));
Executed by:
  • tst_QPrinter
pageLayout().fullRect(QPageLayout::Unit(unit));
executed 18 times by 1 test: return pageLayout().fullRect(QPageLayout::Unit(unit));
Executed by:
  • tst_QPrinter
18
647}-
648QRect QPrinter::pageRect() const-
649{-
650 const QPrinterPrivate * const d = d_func();-
651 return
executed 24 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PageRect).toRect();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_PageRect).toRect();
executed 24 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PageRect).toRect();
Executed by:
  • tst_QPrinter
24
652}-
653QRect QPrinter::paperRect() const-
654{-
655 const QPrinterPrivate * const d = d_func();-
656 return
executed 78 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PaperRect).toRect();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_PaperRect).toRect();
executed 78 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PaperRect).toRect();
Executed by:
  • tst_QPrinter
78
657}-
658void QPrinter::setPageMargins(qreal left, qreal top, qreal right, qreal bottom, QPrinter::Unit unit)-
659{-
660 if (unit == QPrinter::DevicePixel
unit == QPrinter::DevicePixelDescription
TRUEnever evaluated
FALSEevaluated 10 times by 1 test
Evaluated by:
  • tst_QPrinter
) {
0-10
661 QMarginsF margins = QMarginsF(left, top, right, bottom);-
662 margins *= qt_pixelMultiplier(resolution());-
663 margins = qt_convertMargins(margins, QPageLayout::Point, pageLayout().units());-
664 setPageMargins(margins, pageLayout().units());-
665 }
never executed: end of block
else {
0
666 setPageMargins(QMarginsF(left, top, right, bottom), QPageLayout::Unit(unit));-
667 }
executed 10 times by 1 test: end of block
Executed by:
  • tst_QPrinter
10
668}-
669void QPrinter::setMargins(const Margins &m)-
670{-
671 setPageMargins(QMarginsF(m.left, m.top, m.right, m.bottom), QPageLayout::Millimeter);-
672}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
673void QPrinter::getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, QPrinter::Unit unit) const-
674{-
675 QMarginsF margins;-
676 if (unit == QPrinter::DevicePixel
unit == QPrinter::DevicePixelDescription
TRUEnever evaluated
FALSEevaluated 42 times by 1 test
Evaluated by:
  • tst_QPrinter
) {
0-42
677 QMargins tmp = pageLayout().marginsPixels(resolution());-
678 margins = QMarginsF(tmp.left(), tmp.top(), tmp.right(), tmp.bottom());-
679 }
never executed: end of block
else {
0
680 margins = pageLayout().margins(QPageLayout::Unit(unit));-
681 }
executed 42 times by 1 test: end of block
Executed by:
  • tst_QPrinter
42
682 if (left
leftDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-42
683 *
executed 42 times by 1 test: *left = margins.left();
Executed by:
  • tst_QPrinter
left = margins.left();
executed 42 times by 1 test: *left = margins.left();
Executed by:
  • tst_QPrinter
42
684 if (right
rightDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-42
685 *
executed 42 times by 1 test: *right = margins.right();
Executed by:
  • tst_QPrinter
right = margins.right();
executed 42 times by 1 test: *right = margins.right();
Executed by:
  • tst_QPrinter
42
686 if (top
topDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-42
687 *
executed 42 times by 1 test: *top = margins.top();
Executed by:
  • tst_QPrinter
top = margins.top();
executed 42 times by 1 test: *top = margins.top();
Executed by:
  • tst_QPrinter
42
688 if (bottom
bottomDescription
TRUEevaluated 42 times by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-42
689 *
executed 42 times by 1 test: *bottom = margins.bottom();
Executed by:
  • tst_QPrinter
bottom = margins.bottom();
executed 42 times by 1 test: *bottom = margins.bottom();
Executed by:
  • tst_QPrinter
42
690}
executed 42 times by 1 test: end of block
Executed by:
  • tst_QPrinter
42
691-
692-
693-
694-
695-
696-
697int QPrinter::metric(PaintDeviceMetric id) const-
698{-
699 const QPrinterPrivate * const d = d_func();-
700 return
executed 193 times by 1 test: return d->printEngine->metric(id);
Executed by:
  • tst_QPrinter
d->printEngine->metric(id);
executed 193 times by 1 test: return d->printEngine->metric(id);
Executed by:
  • tst_QPrinter
193
701}-
702-
703-
704-
705-
706QPaintEngine *QPrinter::paintEngine() const-
707{-
708 const QPrinterPrivate * const d = d_func();-
709 return
executed 22 times by 1 test: return d->paintEngine;
Executed by:
  • tst_QPrinter
d->paintEngine;
executed 22 times by 1 test: return d->paintEngine;
Executed by:
  • tst_QPrinter
22
710}-
711-
712-
713-
714-
715-
716-
717QPrintEngine *QPrinter::printEngine() const-
718{-
719 const QPrinterPrivate * const d = d_func();-
720 return
never executed: return d->printEngine;
d->printEngine;
never executed: return d->printEngine;
0
721}-
722void QPrinter::setWinPageSize(int pageSize)-
723{-
724 QPrinterPrivate * const d = d_func();-
725 if (d->printEngine->printerState() == QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) { QMessageLogger(__FILE__, 1921, __PRETTY_FUNCTION__).warning("%s: Cannot be changed while printer is active", "QPrinter::setWinPageSize"); return;
never executed: return;
};
0-1
726 d->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize);-
727}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
728int QPrinter::winPageSize() const-
729{-
730 const QPrinterPrivate * const d = d_func();-
731 return
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_WindowsPageSize).toInt();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_WindowsPageSize).toInt();
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_WindowsPageSize).toInt();
Executed by:
  • tst_QPrinter
2
732}-
733QList<int> QPrinter::supportedResolutions() const-
734{-
735 const QPrinterPrivate * const d = d_func();-
736 const QList<QVariant> varlist-
737 = d->printEngine->property(QPrintEngine::PPK_SupportedResolutions).toList();-
738 QList<int> intlist;-
739 intlist.reserve(varlist.size());-
740 for (auto var : varlist)-
741 intlist << var.toInt();
executed 1 time by 1 test: intlist << var.toInt();
Executed by:
  • tst_QPrinter
1
742 return
executed 1 time by 1 test: return intlist;
Executed by:
  • tst_QPrinter
intlist;
executed 1 time by 1 test: return intlist;
Executed by:
  • tst_QPrinter
1
743}-
744bool QPrinter::newPage()-
745{-
746 QPrinterPrivate * const d = d_func();-
747 if (d->printEngine->printerState() != QPrinter::Active
d->printEngine...rinter::ActiveDescription
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QPrinter
)
0-3
748 return
never executed: return false;
false;
never executed: return false;
0
749 return
executed 3 times by 1 test: return d->printEngine->newPage();
Executed by:
  • tst_QPrinter
d->printEngine->newPage();
executed 3 times by 1 test: return d->printEngine->newPage();
Executed by:
  • tst_QPrinter
3
750}-
751bool QPrinter::abort()-
752{-
753 QPrinterPrivate * const d = d_func();-
754 return
never executed: return d->printEngine->abort();
d->printEngine->abort();
never executed: return d->printEngine->abort();
0
755}-
756-
757-
758-
759-
760-
761-
762QPrinter::PrinterState QPrinter::printerState() const-
763{-
764 const QPrinterPrivate * const d = d_func();-
765 return
never executed: return d->printEngine->printerState();
d->printEngine->printerState();
never executed: return d->printEngine->printerState();
0
766}-
767QString QPrinter::printerSelectionOption() const-
768{-
769 const QPrinterPrivate * const d = d_func();-
770 return
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
Executed by:
  • tst_QPrinter
d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();
Executed by:
  • tst_QPrinter
2
771}-
772void QPrinter::setPrinterSelectionOption(const QString &option)-
773{-
774 QPrinterPrivate * const d = d_func();-
775 d->setProperty(QPrintEngine::PPK_SelectionOption, option);-
776}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
777int QPrinter::fromPage() const-
778{-
779 return
executed 14 times by 2 tests: return d->fromPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
d->fromPage;
executed 14 times by 2 tests: return d->fromPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
14
780}-
781int QPrinter::toPage() const-
782{-
783 return
executed 13 times by 2 tests: return d->toPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
d->toPage;
executed 13 times by 2 tests: return d->toPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
13
784}-
785void QPrinter::setFromTo(int from, int to)-
786{-
787 if (from > to
from > toDescription
TRUEnever evaluated
FALSEevaluated 3 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
) {
0-3
788 QMessageLogger(__FILE__, 2138, __PRETTY_FUNCTION__).warning("QPrinter::setFromTo: 'from' must be less than or equal to 'to'");-
789 from = to;-
790 }
never executed: end of block
0
791 d->fromPage = from;-
792 d->toPage = to;-
793}
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
3
794-
795-
796-
797-
798-
799-
800void QPrinter::setPrintRange( PrintRange range )-
801{-
802 d->printSelectionOnly = (range == Selection);-
803-
804 QPrinterPrivate * const d = d_func();-
805 d->printRange = range;-
806}
executed 5 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
5
807QPrinter::PrintRange QPrinter::printRange() const-
808{-
809 const QPrinterPrivate * const d = d_func();-
810 return
executed 3 times by 1 test: return d->printRange;
Executed by:
  • tst_QPrinter
d->printRange;
executed 3 times by 1 test: return d->printRange;
Executed by:
  • tst_QPrinter
3
811}-
812-
Switch to Source codePreprocessed file

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