Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qprinter.cpp |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||
2 | - | |||||||||||||
3 | - | |||||||||||||
4 | - | |||||||||||||
5 | - | |||||||||||||
6 | - | |||||||||||||
7 | - | |||||||||||||
8 | - | |||||||||||||
9 | - | |||||||||||||
10 | extern qreal qt_pixelMultiplier(int resolution); | - | ||||||||||||
11 | extern 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: QPrinter::Millimeter:case QPrinter::Millimeter: never executed: case QPrinter::Millimeter: | 0 | ||||||||||||
18 | return never executed: 2.83464566929;return 2.83464566929; never executed: return 2.83464566929; | 0 | ||||||||||||
19 | case never executed: QPrinter::Point:case QPrinter::Point: never executed: case QPrinter::Point: | 0 | ||||||||||||
20 | return never executed: 1.0;return 1.0; never executed: return 1.0; | 0 | ||||||||||||
21 | case never executed: QPrinter::Inch:case QPrinter::Inch: never executed: case QPrinter::Inch: | 0 | ||||||||||||
22 | return never executed: 72.0;return 72.0; never executed: return 72.0; | 0 | ||||||||||||
23 | case never executed: QPrinter::Pica:case QPrinter::Pica: never executed: case QPrinter::Pica: | 0 | ||||||||||||
24 | return never executed: 12;return 12; never executed: return 12; | 0 | ||||||||||||
25 | case never executed: QPrinter::Didot:case QPrinter::Didot: never executed: case QPrinter::Didot: | 0 | ||||||||||||
26 | return never executed: 1.065826771;return 1.065826771; never executed: return 1.065826771; | 0 | ||||||||||||
27 | case never executed: QPrinter::Cicero:case QPrinter::Cicero: never executed: case QPrinter::Cicero: | 0 | ||||||||||||
28 | return never executed: 12.789921252;return 12.789921252; never executed: return 12.789921252; | 0 | ||||||||||||
29 | case never executed: QPrinter::DevicePixel:case QPrinter::DevicePixel: never executed: case QPrinter::DevicePixel: | 0 | ||||||||||||
30 | return never executed: 72.0/resolution;return 72.0/resolution; never executed: return 72.0/resolution; | 0 | ||||||||||||
31 | } | - | ||||||||||||
32 | return never executed: 1.0;return 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
| 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: orientation == QPrinter::Landscape ? sizef.transposed() : sizef;return orientation == QPrinter::Landscape ? sizef.transposed() : sizef; never executed: return orientation == QPrinter::Landscape ? sizef.transposed() : sizef; | 0 | ||||||||||||
48 | } | - | ||||||||||||
49 | - | |||||||||||||
50 | QPrinterInfo QPrinterPrivate::findValidPrinter(const QPrinterInfo &printer) | - | ||||||||||||
51 | { | - | ||||||||||||
52 | - | |||||||||||||
53 | QPrinterInfo printerToUse = printer; | - | ||||||||||||
54 | if (printerToUse.isNull()
| 0-134 | ||||||||||||
55 | printerToUse = QPrinterInfo::defaultPrinter(); | - | ||||||||||||
56 | if (printerToUse.isNull()
| 0-134 | ||||||||||||
57 | QStringList availablePrinterNames = QPrinterInfo::availablePrinterNames(); | - | ||||||||||||
58 | if (!availablePrinterNames.isEmpty()
| 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:
| 134 | ||||||||||||
61 | } executed 134 times by 2 tests: end of block Executed by:
| 134 | ||||||||||||
62 | return executed 134 times by 2 tests: printerToUse;return printerToUse; Executed by:
executed 134 times by 2 tests: return printerToUse; Executed by:
| 134 | ||||||||||||
63 | } | - | ||||||||||||
64 | - | |||||||||||||
65 | void 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
| 0-128 | ||||||||||||
74 | ps = QPlatformPrinterSupportPlugin::get(); | - | ||||||||||||
75 | QPrinterInfo printerToUse = findValidPrinter(printer); | - | ||||||||||||
76 | if (ps
| 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:
| 128 | ||||||||||||
81 | - | |||||||||||||
82 | if (outputFormat == QPrinter::NativeFormat
| 0-128 | ||||||||||||
83 | printEngine = ps->createNativePrintEngine(printerMode); | - | ||||||||||||
84 | paintEngine = ps->createPaintEngine(printEngine, printerMode); | - | ||||||||||||
85 | } never executed: else {end of block | 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:
| 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:
| 128 | ||||||||||||
96 | - | |||||||||||||
97 | void 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
| 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
| 0 | ||||||||||||
112 | prop = QVariant(q_ptr->copyCount()); never executed: prop = QVariant(q_ptr->copyCount()); | 0 | ||||||||||||
113 | else if (key != QPrintEngine::PPK_PrinterName
| 0 | ||||||||||||
114 | prop = oldPrintEngine->property(key); never executed: prop = oldPrintEngine->property(key); | 0 | ||||||||||||
115 | if (prop.isValid()
| 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
| 0 | ||||||||||||
121 | delete oldPrintEngine; never executed: delete oldPrintEngine; | 0 | ||||||||||||
122 | } never executed: end of block | 0 | ||||||||||||
123 | - | |||||||||||||
124 | - | |||||||||||||
125 | QList<const QPicture *> QPrinterPrivate::previewPages() const | - | ||||||||||||
126 | { | - | ||||||||||||
127 | if (previewEngine
| 0-1 | ||||||||||||
128 | return executed 1 time by 1 test: previewEngine->pages();return previewEngine->pages(); Executed by:
executed 1 time by 1 test: return previewEngine->pages(); Executed by:
| 1 | ||||||||||||
129 | return never executed: QList<const QPicture *>();return QList<const QPicture *>(); never executed: return QList<const QPicture *>(); | 0 | ||||||||||||
130 | } | - | ||||||||||||
131 | - | |||||||||||||
132 | void QPrinterPrivate::setPreviewMode(bool enable) | - | ||||||||||||
133 | { | - | ||||||||||||
134 | QPrinter * const q = q_func(); | - | ||||||||||||
135 | if (enable
| 1 | ||||||||||||
136 | if (!previewEngine
| 0-1 | ||||||||||||
137 | previewEngine = new QPreviewPaintEngine; executed 1 time by 1 test: previewEngine = new QPreviewPaintEngine; Executed by:
| 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: else {end of block Executed by:
| 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:
| 1 | ||||||||||||
148 | } | - | ||||||||||||
149 | - | |||||||||||||
150 | - | |||||||||||||
151 | void 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:
| 336 | ||||||||||||
156 | - | |||||||||||||
157 | - | |||||||||||||
158 | class QPrinterPagedPaintDevicePrivate : public QPagedPaintDevicePrivate | - | ||||||||||||
159 | { | - | ||||||||||||
160 | public: | - | ||||||||||||
161 | QPrinterPagedPaintDevicePrivate(QPrinterPrivate *d) | - | ||||||||||||
162 | : QPagedPaintDevicePrivate(), pd(d) | - | ||||||||||||
163 | {} executed 128 times by 2 tests: end of block Executed by:
| 128 | ||||||||||||
164 | - | |||||||||||||
165 | virtual ~QPrinterPagedPaintDevicePrivate() | - | ||||||||||||
166 | {} | - | ||||||||||||
167 | - | |||||||||||||
168 | bool setPageLayout(const QPageLayout &newPageLayout) override | - | ||||||||||||
169 | { | - | ||||||||||||
170 | if (pd->paintEngine->type() != QPaintEngine::Pdf
| 0 | ||||||||||||
171 | && pd->printEngine->printerState() == QPrinter::Active
| 0 | ||||||||||||
172 | QMessageLogger(__FILE__, 236, __PRETTY_FUNCTION__).warning("QPrinter::setPageLayout: Cannot be changed while printer is active"); | - | ||||||||||||
173 | return never executed: false;return 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: pageLayout().isEquivalentTo(newPageLayout);return 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
| 0-47 | ||||||||||||
188 | && pd->printEngine->printerState() == QPrinter::Active
| 0 | ||||||||||||
189 | QMessageLogger(__FILE__, 253, __PRETTY_FUNCTION__).warning("QPrinter::setPageLayout: Cannot be changed while printer is active"); | - | ||||||||||||
190 | return never executed: false;return 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: pageLayout().pageSize().isEquivalentTo(pageSize);return pageLayout().pageSize().isEquivalentTo(pageSize); Executed by:
executed 47 times by 1 test: return pageLayout().pageSize().isEquivalentTo(pageSize); Executed by:
| 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: pageLayout().orientation() == orientation;return pageLayout().orientation() == orientation; Executed by:
executed 48 times by 1 test: return pageLayout().orientation() == orientation; Executed by:
| 48 | ||||||||||||
212 | } | - | ||||||||||||
213 | - | |||||||||||||
214 | bool setPageMargins(const QMarginsF &margins) override | - | ||||||||||||
215 | { | - | ||||||||||||
216 | return never executed: setPageMargins(margins, pageLayout().units());return 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: pageLayout().margins() == margins && pageLayout().units() == units;return pageLayout().margins() == margins && pageLayout().units() == units; Executed by:
executed 13 times by 1 test: return pageLayout().margins() == margins && pageLayout().units() == units; Executed by:
| 13 | ||||||||||||
229 | } | - | ||||||||||||
230 | - | |||||||||||||
231 | QPageLayout pageLayout() const override | - | ||||||||||||
232 | { | - | ||||||||||||
233 | return executed 462 times by 1 test: pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value<QPageLayout>();return pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value<QPageLayout>(); Executed by:
executed 462 times by 1 test: return pd->printEngine->property(QPrintEngine::PPK_QPageLayout).value<QPageLayout>(); Executed by:
| 462 | ||||||||||||
234 | } | - | ||||||||||||
235 | - | |||||||||||||
236 | QPrinterPrivate *pd; | - | ||||||||||||
237 | }; | - | ||||||||||||
238 | QPrinter::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:
| 128 | ||||||||||||
246 | - | |||||||||||||
247 | - | |||||||||||||
248 | - | |||||||||||||
249 | - | |||||||||||||
250 | - | |||||||||||||
251 | - | |||||||||||||
252 | QPrinter::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 | - | |||||||||||||
261 | void QPrinterPrivate::init(const QPrinterInfo &printer, QPrinter::PrinterMode mode) | - | ||||||||||||
262 | { | - | ||||||||||||
263 | if (__builtin_expect(!!(!QCoreApplication::instance()), false)
| 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:
| 128 | ||||||||||||
272 | void QPrinter::setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine) | - | ||||||||||||
273 | { | - | ||||||||||||
274 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
275 | - | |||||||||||||
276 | if (d->use_default_engine
| 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:
| 2 | ||||||||||||
283 | - | |||||||||||||
284 | - | |||||||||||||
285 | - | |||||||||||||
286 | - | |||||||||||||
287 | - | |||||||||||||
288 | - | |||||||||||||
289 | QPrinter::~QPrinter() | - | ||||||||||||
290 | { | - | ||||||||||||
291 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
292 | if (d->use_default_engine
| 0-128 | ||||||||||||
293 | delete d->printEngine; executed 128 times by 2 tests: delete d->printEngine; Executed by:
| 128 | ||||||||||||
294 | - | |||||||||||||
295 | delete d->previewEngine; | - | ||||||||||||
296 | - | |||||||||||||
297 | } executed 128 times by 2 tests: end of block Executed by:
| 128 | ||||||||||||
298 | void QPrinter::setOutputFormat(OutputFormat format) | - | ||||||||||||
299 | { | - | ||||||||||||
300 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
301 | - | |||||||||||||
302 | if (d->outputFormat == format
| 6-40 | ||||||||||||
303 | return; executed 40 times by 1 test: return; Executed by:
| 40 | ||||||||||||
304 | - | |||||||||||||
305 | if (format == QPrinter::NativeFormat
| 0-6 | ||||||||||||
306 | QPrinterInfo printerToUse = d->findValidPrinter(); | - | ||||||||||||
307 | if (!printerToUse.isNull()
| 0-6 | ||||||||||||
308 | d->changeEngines(format, printerToUse); never executed: d->changeEngines(format, printerToUse); | 0 | ||||||||||||
309 | } executed 6 times by 1 test: else {end of block Executed by:
| 6 | ||||||||||||
310 | d->changeEngines(format, QPrinterInfo()); | - | ||||||||||||
311 | } never executed: end of block | 0 | ||||||||||||
312 | } | - | ||||||||||||
313 | - | |||||||||||||
314 | - | |||||||||||||
315 | - | |||||||||||||
316 | - | |||||||||||||
317 | - | |||||||||||||
318 | - | |||||||||||||
319 | QPrinter::OutputFormat QPrinter::outputFormat() const | - | ||||||||||||
320 | { | - | ||||||||||||
321 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
322 | return executed 48 times by 1 test: d->outputFormat;return d->outputFormat; Executed by:
executed 48 times by 1 test: return d->outputFormat; Executed by:
| 48 | ||||||||||||
323 | } | - | ||||||||||||
324 | - | |||||||||||||
325 | - | |||||||||||||
326 | - | |||||||||||||
327 | - | |||||||||||||
328 | - | |||||||||||||
329 | int QPrinter::devType() const | - | ||||||||||||
330 | { | - | ||||||||||||
331 | return executed 108 times by 1 test: QInternal::Printer;return QInternal::Printer; Executed by:
executed 108 times by 1 test: return QInternal::Printer; Executed by:
| 108 | ||||||||||||
332 | } | - | ||||||||||||
333 | - | |||||||||||||
334 | - | |||||||||||||
335 | - | |||||||||||||
336 | - | |||||||||||||
337 | - | |||||||||||||
338 | - | |||||||||||||
339 | - | |||||||||||||
340 | QString QPrinter::printerName() const | - | ||||||||||||
341 | { | - | ||||||||||||
342 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
343 | return executed 15 times by 1 test: d->printEngine->property(QPrintEngine::PPK_PrinterName).toString();return d->printEngine->property(QPrintEngine::PPK_PrinterName).toString(); Executed by:
executed 15 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PrinterName).toString(); Executed by:
| 15 | ||||||||||||
344 | } | - | ||||||||||||
345 | void QPrinter::setPrinterName(const QString &name) | - | ||||||||||||
346 | { | - | ||||||||||||
347 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
348 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-5 | ||||||||||||
349 | - | |||||||||||||
350 | if (printerName() == name
| 1-4 | ||||||||||||
351 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||
352 | - | |||||||||||||
353 | if (name.isEmpty()
| 0-1 | ||||||||||||
354 | setOutputFormat(QPrinter::PdfFormat); | - | ||||||||||||
355 | return; never executed: return; | 0 | ||||||||||||
356 | } | - | ||||||||||||
357 | - | |||||||||||||
358 | QPrinterInfo printerToUse = QPrinterInfo::printerInfo(name); | - | ||||||||||||
359 | if (printerToUse.isNull()
| 0-1 | ||||||||||||
360 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||
361 | - | |||||||||||||
362 | if (outputFormat() == QPrinter::PdfFormat
| 0 | ||||||||||||
363 | d->changeEngines(QPrinter::NativeFormat, printerToUse); | - | ||||||||||||
364 | } never executed: else {end of block | 0 | ||||||||||||
365 | d->setProperty(QPrintEngine::PPK_PrinterName, name); | - | ||||||||||||
366 | } never executed: end of block | 0 | ||||||||||||
367 | } | - | ||||||||||||
368 | bool QPrinter::isValid() const | - | ||||||||||||
369 | { | - | ||||||||||||
370 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
371 | if (!QCoreApplication::instance()
| 0-3 | ||||||||||||
372 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
373 | return executed 3 times by 1 test: d->validPrinter;return d->validPrinter; Executed by:
executed 3 times by 1 test: return d->validPrinter; Executed by:
| 3 | ||||||||||||
374 | } | - | ||||||||||||
375 | QString QPrinter::outputFileName() const | - | ||||||||||||
376 | { | - | ||||||||||||
377 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
378 | return executed 5 times by 1 test: d->printEngine->property(QPrintEngine::PPK_OutputFileName).toString();return d->printEngine->property(QPrintEngine::PPK_OutputFileName).toString(); Executed by:
executed 5 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_OutputFileName).toString(); Executed by:
| 5 | ||||||||||||
379 | } | - | ||||||||||||
380 | void QPrinter::setOutputFileName(const QString &fileName) | - | ||||||||||||
381 | { | - | ||||||||||||
382 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
383 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-39 | ||||||||||||
384 | - | |||||||||||||
385 | QFileInfo fi(fileName); | - | ||||||||||||
386 | if (!fi.suffix().compare(QLatin1String("pdf"), Qt::CaseInsensitive)
| 6-33 | ||||||||||||
387 | setOutputFormat(QPrinter::PdfFormat); executed 6 times by 1 test: setOutputFormat(QPrinter::PdfFormat); Executed by:
| 6 | ||||||||||||
388 | else if (fileName.isEmpty()
| 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:
| 39 | ||||||||||||
393 | QString QPrinter::printProgram() const | - | ||||||||||||
394 | { | - | ||||||||||||
395 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
396 | return executed 2 times by 1 test: d->printEngine->property(QPrintEngine::PPK_PrinterProgram).toString();return d->printEngine->property(QPrintEngine::PPK_PrinterProgram).toString(); Executed by:
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PrinterProgram).toString(); Executed by:
| 2 | ||||||||||||
397 | } | - | ||||||||||||
398 | void QPrinter::setPrintProgram(const QString &printProg) | - | ||||||||||||
399 | { | - | ||||||||||||
400 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
401 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
402 | d->setProperty(QPrintEngine::PPK_PrinterProgram, printProg); | - | ||||||||||||
403 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
404 | - | |||||||||||||
405 | - | |||||||||||||
406 | - | |||||||||||||
407 | - | |||||||||||||
408 | - | |||||||||||||
409 | - | |||||||||||||
410 | - | |||||||||||||
411 | QString QPrinter::docName() const | - | ||||||||||||
412 | { | - | ||||||||||||
413 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
414 | return executed 6 times by 1 test: d->printEngine->property(QPrintEngine::PPK_DocumentName).toString();return d->printEngine->property(QPrintEngine::PPK_DocumentName).toString(); Executed by:
executed 6 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_DocumentName).toString(); Executed by:
| 6 | ||||||||||||
415 | } | - | ||||||||||||
416 | void QPrinter::setDocName(const QString &name) | - | ||||||||||||
417 | { | - | ||||||||||||
418 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
419 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-2 | ||||||||||||
420 | d->setProperty(QPrintEngine::PPK_DocumentName, name); | - | ||||||||||||
421 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
422 | - | |||||||||||||
423 | - | |||||||||||||
424 | - | |||||||||||||
425 | - | |||||||||||||
426 | - | |||||||||||||
427 | - | |||||||||||||
428 | - | |||||||||||||
429 | QString QPrinter::creator() const | - | ||||||||||||
430 | { | - | ||||||||||||
431 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
432 | return executed 2 times by 1 test: d->printEngine->property(QPrintEngine::PPK_Creator).toString();return d->printEngine->property(QPrintEngine::PPK_Creator).toString(); Executed by:
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_Creator).toString(); Executed by:
| 2 | ||||||||||||
433 | } | - | ||||||||||||
434 | void QPrinter::setCreator(const QString &creator) | - | ||||||||||||
435 | { | - | ||||||||||||
436 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
437 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
438 | d->setProperty(QPrintEngine::PPK_Creator, creator); | - | ||||||||||||
439 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
440 | QPrinter::Orientation QPrinter::orientation() const | - | ||||||||||||
441 | { | - | ||||||||||||
442 | return executed 75 times by 1 test: QPrinter::Orientation(pageLayout().orientation());return QPrinter::Orientation(pageLayout().orientation()); Executed by:
executed 75 times by 1 test: return QPrinter::Orientation(pageLayout().orientation()); Executed by:
| 75 | ||||||||||||
443 | } | - | ||||||||||||
444 | void QPrinter::setOrientation(Orientation orientation) | - | ||||||||||||
445 | { | - | ||||||||||||
446 | setPageOrientation(QPageLayout::Orientation(orientation)); | - | ||||||||||||
447 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||
448 | QPrinter::PaperSize QPrinter::paperSize() const | - | ||||||||||||
449 | { | - | ||||||||||||
450 | return executed 2 times by 1 test: pageSize();return pageSize(); Executed by:
executed 2 times by 1 test: return pageSize(); Executed by:
| 2 | ||||||||||||
451 | } | - | ||||||||||||
452 | void QPrinter::setPaperSize(PaperSize newPaperSize) | - | ||||||||||||
453 | { | - | ||||||||||||
454 | setPageSize(QPageSize(QPageSize::PageSizeId(newPaperSize))); | - | ||||||||||||
455 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
456 | QPrinter::PageSize QPrinter::pageSize() const | - | ||||||||||||
457 | { | - | ||||||||||||
458 | return executed 31 times by 1 test: QPrinter::PaperSize(pageLayout().pageSize().id());return QPrinter::PaperSize(pageLayout().pageSize().id()); Executed by:
executed 31 times by 1 test: return QPrinter::PaperSize(pageLayout().pageSize().id()); Executed by:
| 31 | ||||||||||||
459 | } | - | ||||||||||||
460 | void QPrinter::setPageSize(PageSize newPageSize) | - | ||||||||||||
461 | { | - | ||||||||||||
462 | setPageSize(QPageSize(QPageSize::PageSizeId(newPageSize))); | - | ||||||||||||
463 | } executed 31 times by 1 test: end of block Executed by:
| 31 | ||||||||||||
464 | void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit) | - | ||||||||||||
465 | { | - | ||||||||||||
466 | if (unit == QPrinter::DevicePixel
| 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:
| 1 | ||||||||||||
468 | else | - | ||||||||||||
469 | setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); executed 6 times by 1 test: setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); Executed by:
| 6 | ||||||||||||
470 | } | - | ||||||||||||
471 | void QPrinter::setPageSizeMM(const QSizeF &size) | - | ||||||||||||
472 | { | - | ||||||||||||
473 | setPageSize(QPageSize(size, QPageSize::Millimeter)); | - | ||||||||||||
474 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
475 | QSizeF QPrinter::paperSize(Unit unit) const | - | ||||||||||||
476 | { | - | ||||||||||||
477 | if (unit == QPrinter::DevicePixel
| 1-21 | ||||||||||||
478 | return executed 1 time by 1 test: pageLayout().fullRectPixels(resolution()).size();return pageLayout().fullRectPixels(resolution()).size(); Executed by:
executed 1 time by 1 test: return pageLayout().fullRectPixels(resolution()).size(); Executed by:
| 1 | ||||||||||||
479 | else | - | ||||||||||||
480 | return executed 21 times by 1 test: pageLayout().fullRect(QPageLayout::Unit(unit)).size();return pageLayout().fullRect(QPageLayout::Unit(unit)).size(); Executed by:
executed 21 times by 1 test: return pageLayout().fullRect(QPageLayout::Unit(unit)).size(); Executed by:
| 21 | ||||||||||||
481 | } | - | ||||||||||||
482 | void QPrinter::setPaperName(const QString &paperName) | - | ||||||||||||
483 | { | - | ||||||||||||
484 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
485 | if (d->paintEngine->type() != QPaintEngine::Pdf
| 0 | ||||||||||||
486 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0 | ||||||||||||
487 | d->setProperty(QPrintEngine::PPK_PaperName, paperName); | - | ||||||||||||
488 | } never executed: end of block | 0 | ||||||||||||
489 | QString QPrinter::paperName() const | - | ||||||||||||
490 | { | - | ||||||||||||
491 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
492 | return never executed: d->printEngine->property(QPrintEngine::PPK_PaperName).toString();return d->printEngine->property(QPrintEngine::PPK_PaperName).toString(); never executed: return d->printEngine->property(QPrintEngine::PPK_PaperName).toString(); | 0 | ||||||||||||
493 | } | - | ||||||||||||
494 | void QPrinter::setPageOrder(PageOrder pageOrder) | - | ||||||||||||
495 | { | - | ||||||||||||
496 | d->pageOrderAscending = (pageOrder == FirstPageFirst); | - | ||||||||||||
497 | - | |||||||||||||
498 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
499 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
500 | d->setProperty(QPrintEngine::PPK_PageOrder, pageOrder); | - | ||||||||||||
501 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
502 | QPrinter::PageOrder QPrinter::pageOrder() const | - | ||||||||||||
503 | { | - | ||||||||||||
504 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
505 | return executed 6 times by 1 test: QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt());return QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt()); Executed by:
executed 6 times by 1 test: return QPrinter::PageOrder(d->printEngine->property(QPrintEngine::PPK_PageOrder).toInt()); Executed by:
| 6 | ||||||||||||
506 | } | - | ||||||||||||
507 | void QPrinter::setColorMode(ColorMode newColorMode) | - | ||||||||||||
508 | { | - | ||||||||||||
509 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
510 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
511 | d->setProperty(QPrintEngine::PPK_ColorMode, newColorMode); | - | ||||||||||||
512 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
513 | - | |||||||||||||
514 | - | |||||||||||||
515 | - | |||||||||||||
516 | - | |||||||||||||
517 | - | |||||||||||||
518 | - | |||||||||||||
519 | - | |||||||||||||
520 | QPrinter::ColorMode QPrinter::colorMode() const | - | ||||||||||||
521 | { | - | ||||||||||||
522 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
523 | return executed 6 times by 1 test: QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt());return QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt()); Executed by:
executed 6 times by 1 test: return QPrinter::ColorMode(d->printEngine->property(QPrintEngine::PPK_ColorMode).toInt()); Executed by:
| 6 | ||||||||||||
524 | } | - | ||||||||||||
525 | int QPrinter::numCopies() const | - | ||||||||||||
526 | { | - | ||||||||||||
527 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
528 | return executed 3 times by 1 test: d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt();return d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt(); Executed by:
executed 3 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_NumberOfCopies).toInt(); Executed by:
| 3 | ||||||||||||
529 | } | - | ||||||||||||
530 | int QPrinter::actualNumCopies() const | - | ||||||||||||
531 | { | - | ||||||||||||
532 | return executed 3 times by 1 test: copyCount();return copyCount(); Executed by:
executed 3 times by 1 test: return copyCount(); Executed by:
| 3 | ||||||||||||
533 | } | - | ||||||||||||
534 | void QPrinter::setNumCopies(int numCopies) | - | ||||||||||||
535 | { | - | ||||||||||||
536 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
537 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
538 | d->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies); | - | ||||||||||||
539 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
540 | void QPrinter::setCopyCount(int count) | - | ||||||||||||
541 | { | - | ||||||||||||
542 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
543 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
544 | d->setProperty(QPrintEngine::PPK_CopyCount, count); | - | ||||||||||||
545 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
546 | int QPrinter::copyCount() const | - | ||||||||||||
547 | { | - | ||||||||||||
548 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
549 | return executed 10 times by 1 test: d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt();return d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt(); Executed by:
executed 10 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_CopyCount).toInt(); Executed by:
| 10 | ||||||||||||
550 | } | - | ||||||||||||
551 | bool QPrinter::supportsMultipleCopies() const | - | ||||||||||||
552 | { | - | ||||||||||||
553 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
554 | return executed 1 time by 1 test: d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool();return d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool(); Executed by:
executed 1 time by 1 test: return d->printEngine->property(QPrintEngine::PPK_SupportsMultipleCopies).toBool(); Executed by:
| 1 | ||||||||||||
555 | } | - | ||||||||||||
556 | bool QPrinter::collateCopies() const | - | ||||||||||||
557 | { | - | ||||||||||||
558 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
559 | return executed 6 times by 1 test: d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool();return d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool(); Executed by:
executed 6 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_CollateCopies).toBool(); Executed by:
| 6 | ||||||||||||
560 | } | - | ||||||||||||
561 | void QPrinter::setCollateCopies(bool collate) | - | ||||||||||||
562 | { | - | ||||||||||||
563 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
564 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
565 | d->setProperty(QPrintEngine::PPK_CollateCopies, collate); | - | ||||||||||||
566 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
567 | void 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:
| 19 | ||||||||||||
575 | bool QPrinter::fullPage() const | - | ||||||||||||
576 | { | - | ||||||||||||
577 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
578 | return executed 3 times by 1 test: d->printEngine->property(QPrintEngine::PPK_FullPage).toBool();return d->printEngine->property(QPrintEngine::PPK_FullPage).toBool(); Executed by:
executed 3 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_FullPage).toBool(); Executed by:
| 3 | ||||||||||||
579 | } | - | ||||||||||||
580 | void QPrinter::setResolution(int dpi) | - | ||||||||||||
581 | { | - | ||||||||||||
582 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
583 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-27 | ||||||||||||
584 | d->setProperty(QPrintEngine::PPK_Resolution, dpi); | - | ||||||||||||
585 | } executed 27 times by 1 test: end of block Executed by:
| 27 | ||||||||||||
586 | int QPrinter::resolution() const | - | ||||||||||||
587 | { | - | ||||||||||||
588 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
589 | return executed 110 times by 1 test: d->printEngine->property(QPrintEngine::PPK_Resolution).toInt();return d->printEngine->property(QPrintEngine::PPK_Resolution).toInt(); Executed by:
executed 110 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_Resolution).toInt(); Executed by:
| 110 | ||||||||||||
590 | } | - | ||||||||||||
591 | void 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:
| 1 | ||||||||||||
596 | - | |||||||||||||
597 | - | |||||||||||||
598 | - | |||||||||||||
599 | - | |||||||||||||
600 | - | |||||||||||||
601 | QPrinter::PaperSource QPrinter::paperSource() const | - | ||||||||||||
602 | { | - | ||||||||||||
603 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
604 | return executed 2 times by 1 test: QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt());return QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt()); Executed by:
executed 2 times by 1 test: return QPrinter::PaperSource(d->printEngine->property(QPrintEngine::PPK_PaperSource).toInt()); Executed by:
| 2 | ||||||||||||
605 | } | - | ||||||||||||
606 | void 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:
| 1 | ||||||||||||
611 | bool QPrinter::fontEmbeddingEnabled() const | - | ||||||||||||
612 | { | - | ||||||||||||
613 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
614 | return executed 2 times by 1 test: d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool();return d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool(); Executed by:
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_FontEmbedding).toBool(); Executed by:
| 2 | ||||||||||||
615 | } | - | ||||||||||||
616 | void QPrinter::setDoubleSidedPrinting(bool doubleSided) | - | ||||||||||||
617 | { | - | ||||||||||||
618 | setDuplex(doubleSided ? DuplexAuto : DuplexNone); | - | ||||||||||||
619 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
620 | bool QPrinter::doubleSidedPrinting() const | - | ||||||||||||
621 | { | - | ||||||||||||
622 | return executed 2 times by 1 test: duplex() != DuplexNone;return duplex() != DuplexNone; Executed by:
executed 2 times by 1 test: return duplex() != DuplexNone; Executed by:
| 2 | ||||||||||||
623 | } | - | ||||||||||||
624 | void 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:
| 2 | ||||||||||||
629 | QPrinter::DuplexMode QPrinter::duplex() const | - | ||||||||||||
630 | { | - | ||||||||||||
631 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
632 | return executed 8 times by 1 test: static_cast <DuplexMode> (d->printEngine->property(QPrintEngine::PPK_Duplex).toInt());return static_cast <DuplexMode> (d->printEngine->property(QPrintEngine::PPK_Duplex).toInt()); Executed by:
executed 8 times by 1 test: return static_cast <DuplexMode> (d->printEngine->property(QPrintEngine::PPK_Duplex).toInt()); Executed by:
| 8 | ||||||||||||
633 | } | - | ||||||||||||
634 | QRectF QPrinter::pageRect(Unit unit) const | - | ||||||||||||
635 | { | - | ||||||||||||
636 | if (unit == QPrinter::DevicePixel
| 4-18 | ||||||||||||
637 | return executed 4 times by 1 test: pageLayout().paintRectPixels(resolution());return pageLayout().paintRectPixels(resolution()); Executed by:
executed 4 times by 1 test: return pageLayout().paintRectPixels(resolution()); Executed by:
| 4 | ||||||||||||
638 | else | - | ||||||||||||
639 | return executed 18 times by 1 test: pageLayout().paintRect(QPageLayout::Unit(unit));return pageLayout().paintRect(QPageLayout::Unit(unit)); Executed by:
executed 18 times by 1 test: return pageLayout().paintRect(QPageLayout::Unit(unit)); Executed by:
| 18 | ||||||||||||
640 | } | - | ||||||||||||
641 | QRectF QPrinter::paperRect(Unit unit) const | - | ||||||||||||
642 | { | - | ||||||||||||
643 | if (unit == QPrinter::DevicePixel
| 0-18 | ||||||||||||
644 | return never executed: pageLayout().fullRectPixels(resolution());return pageLayout().fullRectPixels(resolution()); never executed: return pageLayout().fullRectPixels(resolution()); | 0 | ||||||||||||
645 | else | - | ||||||||||||
646 | return executed 18 times by 1 test: pageLayout().fullRect(QPageLayout::Unit(unit));return pageLayout().fullRect(QPageLayout::Unit(unit)); Executed by:
executed 18 times by 1 test: return pageLayout().fullRect(QPageLayout::Unit(unit)); Executed by:
| 18 | ||||||||||||
647 | } | - | ||||||||||||
648 | QRect QPrinter::pageRect() const | - | ||||||||||||
649 | { | - | ||||||||||||
650 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
651 | return executed 24 times by 1 test: d->printEngine->property(QPrintEngine::PPK_PageRect).toRect();return d->printEngine->property(QPrintEngine::PPK_PageRect).toRect(); Executed by:
executed 24 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PageRect).toRect(); Executed by:
| 24 | ||||||||||||
652 | } | - | ||||||||||||
653 | QRect QPrinter::paperRect() const | - | ||||||||||||
654 | { | - | ||||||||||||
655 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
656 | return executed 78 times by 1 test: d->printEngine->property(QPrintEngine::PPK_PaperRect).toRect();return d->printEngine->property(QPrintEngine::PPK_PaperRect).toRect(); Executed by:
executed 78 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_PaperRect).toRect(); Executed by:
| 78 | ||||||||||||
657 | } | - | ||||||||||||
658 | void QPrinter::setPageMargins(qreal left, qreal top, qreal right, qreal bottom, QPrinter::Unit unit) | - | ||||||||||||
659 | { | - | ||||||||||||
660 | if (unit == QPrinter::DevicePixel
| 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: else {end of block | 0 | ||||||||||||
666 | setPageMargins(QMarginsF(left, top, right, bottom), QPageLayout::Unit(unit)); | - | ||||||||||||
667 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||
668 | } | - | ||||||||||||
669 | void 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:
| 3 | ||||||||||||
673 | void QPrinter::getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, QPrinter::Unit unit) const | - | ||||||||||||
674 | { | - | ||||||||||||
675 | QMarginsF margins; | - | ||||||||||||
676 | if (unit == QPrinter::DevicePixel
| 0-42 | ||||||||||||
677 | QMargins tmp = pageLayout().marginsPixels(resolution()); | - | ||||||||||||
678 | margins = QMarginsF(tmp.left(), tmp.top(), tmp.right(), tmp.bottom()); | - | ||||||||||||
679 | } never executed: else {end of block | 0 | ||||||||||||
680 | margins = pageLayout().margins(QPageLayout::Unit(unit)); | - | ||||||||||||
681 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||
682 | if (left
| 0-42 | ||||||||||||
683 | * executed 42 times by 1 test: left = margins.left();*left = margins.left(); Executed by:
executed 42 times by 1 test: *left = margins.left(); Executed by:
| 42 | ||||||||||||
684 | if (right
| 0-42 | ||||||||||||
685 | * executed 42 times by 1 test: right = margins.right();*right = margins.right(); Executed by:
executed 42 times by 1 test: *right = margins.right(); Executed by:
| 42 | ||||||||||||
686 | if (top
| 0-42 | ||||||||||||
687 | * executed 42 times by 1 test: top = margins.top();*top = margins.top(); Executed by:
executed 42 times by 1 test: *top = margins.top(); Executed by:
| 42 | ||||||||||||
688 | if (bottom
| 0-42 | ||||||||||||
689 | * executed 42 times by 1 test: bottom = margins.bottom();*bottom = margins.bottom(); Executed by:
executed 42 times by 1 test: *bottom = margins.bottom(); Executed by:
| 42 | ||||||||||||
690 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||
691 | - | |||||||||||||
692 | - | |||||||||||||
693 | - | |||||||||||||
694 | - | |||||||||||||
695 | - | |||||||||||||
696 | - | |||||||||||||
697 | int QPrinter::metric(PaintDeviceMetric id) const | - | ||||||||||||
698 | { | - | ||||||||||||
699 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
700 | return executed 193 times by 1 test: d->printEngine->metric(id);return d->printEngine->metric(id); Executed by:
executed 193 times by 1 test: return d->printEngine->metric(id); Executed by:
| 193 | ||||||||||||
701 | } | - | ||||||||||||
702 | - | |||||||||||||
703 | - | |||||||||||||
704 | - | |||||||||||||
705 | - | |||||||||||||
706 | QPaintEngine *QPrinter::paintEngine() const | - | ||||||||||||
707 | { | - | ||||||||||||
708 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
709 | return executed 22 times by 1 test: d->paintEngine;return d->paintEngine; Executed by:
executed 22 times by 1 test: return d->paintEngine; Executed by:
| 22 | ||||||||||||
710 | } | - | ||||||||||||
711 | - | |||||||||||||
712 | - | |||||||||||||
713 | - | |||||||||||||
714 | - | |||||||||||||
715 | - | |||||||||||||
716 | - | |||||||||||||
717 | QPrintEngine *QPrinter::printEngine() const | - | ||||||||||||
718 | { | - | ||||||||||||
719 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
720 | return never executed: d->printEngine;return d->printEngine; never executed: return d->printEngine; | 0 | ||||||||||||
721 | } | - | ||||||||||||
722 | void QPrinter::setWinPageSize(int pageSize) | - | ||||||||||||
723 | { | - | ||||||||||||
724 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
725 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
726 | d->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize); | - | ||||||||||||
727 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
728 | int QPrinter::winPageSize() const | - | ||||||||||||
729 | { | - | ||||||||||||
730 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
731 | return executed 2 times by 1 test: d->printEngine->property(QPrintEngine::PPK_WindowsPageSize).toInt();return d->printEngine->property(QPrintEngine::PPK_WindowsPageSize).toInt(); Executed by:
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_WindowsPageSize).toInt(); Executed by:
| 2 | ||||||||||||
732 | } | - | ||||||||||||
733 | QList<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:
| 1 | ||||||||||||
742 | return executed 1 time by 1 test: intlist;return intlist; Executed by:
executed 1 time by 1 test: return intlist; Executed by:
| 1 | ||||||||||||
743 | } | - | ||||||||||||
744 | bool QPrinter::newPage() | - | ||||||||||||
745 | { | - | ||||||||||||
746 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
747 | if (d->printEngine->printerState() != QPrinter::Active
| 0-3 | ||||||||||||
748 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
749 | return executed 3 times by 1 test: d->printEngine->newPage();return d->printEngine->newPage(); Executed by:
executed 3 times by 1 test: return d->printEngine->newPage(); Executed by:
| 3 | ||||||||||||
750 | } | - | ||||||||||||
751 | bool QPrinter::abort() | - | ||||||||||||
752 | { | - | ||||||||||||
753 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
754 | return never executed: d->printEngine->abort();return d->printEngine->abort(); never executed: return d->printEngine->abort(); | 0 | ||||||||||||
755 | } | - | ||||||||||||
756 | - | |||||||||||||
757 | - | |||||||||||||
758 | - | |||||||||||||
759 | - | |||||||||||||
760 | - | |||||||||||||
761 | - | |||||||||||||
762 | QPrinter::PrinterState QPrinter::printerState() const | - | ||||||||||||
763 | { | - | ||||||||||||
764 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
765 | return never executed: d->printEngine->printerState();return d->printEngine->printerState(); never executed: return d->printEngine->printerState(); | 0 | ||||||||||||
766 | } | - | ||||||||||||
767 | QString QPrinter::printerSelectionOption() const | - | ||||||||||||
768 | { | - | ||||||||||||
769 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
770 | return executed 2 times by 1 test: d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString();return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString(); Executed by:
executed 2 times by 1 test: return d->printEngine->property(QPrintEngine::PPK_SelectionOption).toString(); Executed by:
| 2 | ||||||||||||
771 | } | - | ||||||||||||
772 | void 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:
| 1 | ||||||||||||
777 | int QPrinter::fromPage() const | - | ||||||||||||
778 | { | - | ||||||||||||
779 | return executed 14 times by 2 tests: d->fromPage;return d->fromPage; Executed by:
executed 14 times by 2 tests: return d->fromPage; Executed by:
| 14 | ||||||||||||
780 | } | - | ||||||||||||
781 | int QPrinter::toPage() const | - | ||||||||||||
782 | { | - | ||||||||||||
783 | return executed 13 times by 2 tests: d->toPage;return d->toPage; Executed by:
executed 13 times by 2 tests: return d->toPage; Executed by:
| 13 | ||||||||||||
784 | } | - | ||||||||||||
785 | void QPrinter::setFromTo(int from, int to) | - | ||||||||||||
786 | { | - | ||||||||||||
787 | if (from > to
| 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:
| 3 | ||||||||||||
794 | - | |||||||||||||
795 | - | |||||||||||||
796 | - | |||||||||||||
797 | - | |||||||||||||
798 | - | |||||||||||||
799 | - | |||||||||||||
800 | void 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:
| 5 | ||||||||||||
807 | QPrinter::PrintRange QPrinter::printRange() const | - | ||||||||||||
808 | { | - | ||||||||||||
809 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
810 | return executed 3 times by 1 test: d->printRange;return d->printRange; Executed by:
executed 3 times by 1 test: return d->printRange; Executed by:
| 3 | ||||||||||||
811 | } | - | ||||||||||||
812 | - | |||||||||||||
Switch to Source code | Preprocessed file |