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::Landscapereturn 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 | for (QForeachContainer<typename QtPrivate::remove_reference<decltype(m_properties)>::type> _container_((m_properties)); _container_.control && _container_.i != _container_.e; ++_container_.i, _container_.control ^= 1) for (QPrintEngine::PrintEnginePropertyKey key = *_container_.i; _container_.control; _container_.control = 0) { | - | ||||||||||||
106 | QVariant prop; | - | ||||||||||||
107 | - | |||||||||||||
108 | - | |||||||||||||
109 | - | |||||||||||||
110 | if (key == QPrintEngine::PPK_NumberOfCopies
| 0 | ||||||||||||
111 | prop = QVariant(q_ptr->copyCount()); never executed: prop = QVariant(q_ptr->copyCount()); | 0 | ||||||||||||
112 | else if (key != QPrintEngine::PPK_PrinterName
| 0 | ||||||||||||
113 | prop = oldPrintEngine->property(key); never executed: prop = oldPrintEngine->property(key); | 0 | ||||||||||||
114 | if (prop.isValid()
| 0 | ||||||||||||
115 | setProperty(key, prop); never executed: setProperty(key, prop); | 0 | ||||||||||||
116 | } never executed: end of block | 0 | ||||||||||||
117 | } never executed: end of block | 0 | ||||||||||||
118 | - | |||||||||||||
119 | if (def_engine
| 0 | ||||||||||||
120 | delete oldPrintEngine; never executed: delete oldPrintEngine; | 0 | ||||||||||||
121 | } never executed: end of block | 0 | ||||||||||||
122 | - | |||||||||||||
123 | - | |||||||||||||
124 | QList<const QPicture *> QPrinterPrivate::previewPages() const | - | ||||||||||||
125 | { | - | ||||||||||||
126 | if (previewEngine
| 0-1 | ||||||||||||
127 | 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 | ||||||||||||
128 | return never executed: QList<const QPicture *>();return QList<const QPicture *>(); never executed: return QList<const QPicture *>(); | 0 | ||||||||||||
129 | } | - | ||||||||||||
130 | - | |||||||||||||
131 | void QPrinterPrivate::setPreviewMode(bool enable) | - | ||||||||||||
132 | { | - | ||||||||||||
133 | QPrinter * const q = q_func(); | - | ||||||||||||
134 | if (enable
| 1 | ||||||||||||
135 | if (!previewEngine
| 0-1 | ||||||||||||
136 | previewEngine = new QPreviewPaintEngine; executed 1 time by 1 test: previewEngine = new QPreviewPaintEngine; Executed by:
| 1 | ||||||||||||
137 | had_default_engines = use_default_engine; | - | ||||||||||||
138 | use_default_engine = false; | - | ||||||||||||
139 | realPrintEngine = printEngine; | - | ||||||||||||
140 | realPaintEngine = paintEngine; | - | ||||||||||||
141 | q->setEngines(previewEngine, previewEngine); | - | ||||||||||||
142 | previewEngine->setProxyEngines(realPrintEngine, realPaintEngine); | - | ||||||||||||
143 | } executed 1 time by 1 test: else {end of block Executed by:
| 1 | ||||||||||||
144 | q->setEngines(realPrintEngine, realPaintEngine); | - | ||||||||||||
145 | use_default_engine = had_default_engines; | - | ||||||||||||
146 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
147 | } | - | ||||||||||||
148 | - | |||||||||||||
149 | - | |||||||||||||
150 | void QPrinterPrivate::setProperty(QPrintEngine::PrintEnginePropertyKey key, const QVariant &value) | - | ||||||||||||
151 | { | - | ||||||||||||
152 | printEngine->setProperty(key, value); | - | ||||||||||||
153 | m_properties.insert(key); | - | ||||||||||||
154 | } executed 336 times by 2 tests: end of block Executed by:
| 336 | ||||||||||||
155 | - | |||||||||||||
156 | - | |||||||||||||
157 | class QPrinterPagedPaintDevicePrivate : public QPagedPaintDevicePrivate | - | ||||||||||||
158 | { | - | ||||||||||||
159 | public: | - | ||||||||||||
160 | QPrinterPagedPaintDevicePrivate(QPrinterPrivate *d) | - | ||||||||||||
161 | : QPagedPaintDevicePrivate(), pd(d) | - | ||||||||||||
162 | {} executed 128 times by 2 tests: end of block Executed by:
| 128 | ||||||||||||
163 | - | |||||||||||||
164 | virtual ~QPrinterPagedPaintDevicePrivate() | - | ||||||||||||
165 | {} | - | ||||||||||||
166 | - | |||||||||||||
167 | bool setPageLayout(const QPageLayout &newPageLayout) override | - | ||||||||||||
168 | { | - | ||||||||||||
169 | if (pd->paintEngine->type() != QPaintEngine::Pdf
| 0 | ||||||||||||
170 | && pd->printEngine->printerState() == QPrinter::Active
| 0 | ||||||||||||
171 | QMessageLogger(__FILE__, 229, __PRETTY_FUNCTION__).warning("QPrinter::setPageLayout: Cannot be changed while printer is active"); | - | ||||||||||||
172 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
173 | } | - | ||||||||||||
174 | - | |||||||||||||
175 | - | |||||||||||||
176 | pd->setProperty(QPrintEngine::PPK_QPageLayout, QVariant::fromValue(newPageLayout)); | - | ||||||||||||
177 | - | |||||||||||||
178 | - | |||||||||||||
179 | m_pageLayout = pageLayout(); | - | ||||||||||||
180 | - | |||||||||||||
181 | return never executed: pageLayout().isEquivalentTo(newPageLayout);return pageLayout().isEquivalentTo(newPageLayout); never executed: return pageLayout().isEquivalentTo(newPageLayout); | 0 | ||||||||||||
182 | } | - | ||||||||||||
183 | - | |||||||||||||
184 | bool setPageSize(const QPageSize &pageSize) override | - | ||||||||||||
185 | { | - | ||||||||||||
186 | if (pd->paintEngine->type() != QPaintEngine::Pdf
| 0-47 | ||||||||||||
187 | && pd->printEngine->printerState() == QPrinter::Active
| 0 | ||||||||||||
188 | QMessageLogger(__FILE__, 246, __PRETTY_FUNCTION__).warning("QPrinter::setPageLayout: Cannot be changed while printer is active"); | - | ||||||||||||
189 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
190 | } | - | ||||||||||||
191 | - | |||||||||||||
192 | - | |||||||||||||
193 | - | |||||||||||||
194 | pd->setProperty(QPrintEngine::PPK_QPageSize, QVariant::fromValue(pageSize)); | - | ||||||||||||
195 | - | |||||||||||||
196 | - | |||||||||||||
197 | m_pageLayout = pageLayout(); | - | ||||||||||||
198 | - | |||||||||||||
199 | 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 | ||||||||||||
200 | } | - | ||||||||||||
201 | - | |||||||||||||
202 | bool setPageOrientation(QPageLayout::Orientation orientation) override | - | ||||||||||||
203 | { | - | ||||||||||||
204 | - | |||||||||||||
205 | pd->setProperty(QPrintEngine::PPK_Orientation, orientation); | - | ||||||||||||
206 | - | |||||||||||||
207 | - | |||||||||||||
208 | m_pageLayout = pageLayout(); | - | ||||||||||||
209 | - | |||||||||||||
210 | 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 | ||||||||||||
211 | } | - | ||||||||||||
212 | - | |||||||||||||
213 | bool setPageMargins(const QMarginsF &margins) override | - | ||||||||||||
214 | { | - | ||||||||||||
215 | return never executed: setPageMargins(margins, pageLayout().units());return setPageMargins(margins, pageLayout().units()); never executed: return setPageMargins(margins, pageLayout().units()); | 0 | ||||||||||||
216 | } | - | ||||||||||||
217 | - | |||||||||||||
218 | bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units) override | - | ||||||||||||
219 | { | - | ||||||||||||
220 | - | |||||||||||||
221 | QPair<QMarginsF, QPageLayout::Unit> pair = qMakePair(margins, units); | - | ||||||||||||
222 | pd->setProperty(QPrintEngine::PPK_QPageMargins, QVariant::fromValue(pair)); | - | ||||||||||||
223 | - | |||||||||||||
224 | - | |||||||||||||
225 | m_pageLayout = pageLayout(); | - | ||||||||||||
226 | - | |||||||||||||
227 | return executed 13 times by 1 test: pageLayout().margins() == marginsreturn pageLayout().margins() == margins && pageLayout().units() == units; Executed by:
executed 13 times by 1 test: return pageLayout().margins() == margins && pageLayout().units() == units; Executed by:
| 0-13 | ||||||||||||
228 | } | - | ||||||||||||
229 | - | |||||||||||||
230 | QPageLayout pageLayout() const override | - | ||||||||||||
231 | { | - | ||||||||||||
232 | 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 | ||||||||||||
233 | } | - | ||||||||||||
234 | - | |||||||||||||
235 | QPrinterPrivate *pd; | - | ||||||||||||
236 | }; | - | ||||||||||||
237 | QPrinter::QPrinter(PrinterMode mode) | - | ||||||||||||
238 | : QPagedPaintDevice(), | - | ||||||||||||
239 | d_ptr(new QPrinterPrivate(this)) | - | ||||||||||||
240 | { | - | ||||||||||||
241 | delete d; | - | ||||||||||||
242 | d = new QPrinterPagedPaintDevicePrivate(d_func()); | - | ||||||||||||
243 | d_ptr->init(QPrinterInfo(), mode); | - | ||||||||||||
244 | } executed 128 times by 2 tests: end of block Executed by:
| 128 | ||||||||||||
245 | - | |||||||||||||
246 | - | |||||||||||||
247 | - | |||||||||||||
248 | - | |||||||||||||
249 | - | |||||||||||||
250 | - | |||||||||||||
251 | QPrinter::QPrinter(const QPrinterInfo& printer, PrinterMode mode) | - | ||||||||||||
252 | : QPagedPaintDevice(), | - | ||||||||||||
253 | d_ptr(new QPrinterPrivate(this)) | - | ||||||||||||
254 | { | - | ||||||||||||
255 | delete d; | - | ||||||||||||
256 | d = new QPrinterPagedPaintDevicePrivate(d_func()); | - | ||||||||||||
257 | d_ptr->init(printer, mode); | - | ||||||||||||
258 | } never executed: end of block | 0 | ||||||||||||
259 | - | |||||||||||||
260 | void QPrinterPrivate::init(const QPrinterInfo &printer, QPrinter::PrinterMode mode) | - | ||||||||||||
261 | { | - | ||||||||||||
262 | if (!QCoreApplication::instance()
| 0-128 | ||||||||||||
263 | QMessageLogger(__FILE__, 699, __PRETTY_FUNCTION__).fatal("QPrinter: Must construct a QCoreApplication before a QPrinter"); | - | ||||||||||||
264 | return; never executed: return; | 0 | ||||||||||||
265 | } | - | ||||||||||||
266 | - | |||||||||||||
267 | printerMode = mode; | - | ||||||||||||
268 | - | |||||||||||||
269 | initEngines(QPrinter::NativeFormat, printer); | - | ||||||||||||
270 | } executed 128 times by 2 tests: end of block Executed by:
| 128 | ||||||||||||
271 | void QPrinter::setEngines(QPrintEngine *printEngine, QPaintEngine *paintEngine) | - | ||||||||||||
272 | { | - | ||||||||||||
273 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
274 | - | |||||||||||||
275 | if (d->use_default_engine
| 0-2 | ||||||||||||
276 | delete d->printEngine; never executed: delete d->printEngine; | 0 | ||||||||||||
277 | - | |||||||||||||
278 | d->printEngine = printEngine; | - | ||||||||||||
279 | d->paintEngine = paintEngine; | - | ||||||||||||
280 | d->use_default_engine = false; | - | ||||||||||||
281 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
282 | - | |||||||||||||
283 | - | |||||||||||||
284 | - | |||||||||||||
285 | - | |||||||||||||
286 | - | |||||||||||||
287 | - | |||||||||||||
288 | QPrinter::~QPrinter() | - | ||||||||||||
289 | { | - | ||||||||||||
290 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
291 | if (d->use_default_engine
| 0-128 | ||||||||||||
292 | delete d->printEngine; executed 128 times by 2 tests: delete d->printEngine; Executed by:
| 128 | ||||||||||||
293 | - | |||||||||||||
294 | delete d->previewEngine; | - | ||||||||||||
295 | - | |||||||||||||
296 | } executed 128 times by 2 tests: end of block Executed by:
| 128 | ||||||||||||
297 | void QPrinter::setOutputFormat(OutputFormat format) | - | ||||||||||||
298 | { | - | ||||||||||||
299 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
300 | - | |||||||||||||
301 | if (d->outputFormat == format
| 6-40 | ||||||||||||
302 | return; executed 40 times by 1 test: return; Executed by:
| 40 | ||||||||||||
303 | - | |||||||||||||
304 | if (format == QPrinter::NativeFormat
| 0-6 | ||||||||||||
305 | QPrinterInfo printerToUse = d->findValidPrinter(); | - | ||||||||||||
306 | if (!printerToUse.isNull()
| 0-6 | ||||||||||||
307 | d->changeEngines(format, printerToUse); never executed: d->changeEngines(format, printerToUse); | 0 | ||||||||||||
308 | } executed 6 times by 1 test: else {end of block Executed by:
| 6 | ||||||||||||
309 | d->changeEngines(format, QPrinterInfo()); | - | ||||||||||||
310 | } never executed: end of block | 0 | ||||||||||||
311 | } | - | ||||||||||||
312 | - | |||||||||||||
313 | - | |||||||||||||
314 | - | |||||||||||||
315 | - | |||||||||||||
316 | - | |||||||||||||
317 | - | |||||||||||||
318 | QPrinter::OutputFormat QPrinter::outputFormat() const | - | ||||||||||||
319 | { | - | ||||||||||||
320 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
321 | 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 | ||||||||||||
322 | } | - | ||||||||||||
323 | - | |||||||||||||
324 | - | |||||||||||||
325 | - | |||||||||||||
326 | - | |||||||||||||
327 | - | |||||||||||||
328 | int QPrinter::devType() const | - | ||||||||||||
329 | { | - | ||||||||||||
330 | 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 | ||||||||||||
331 | } | - | ||||||||||||
332 | - | |||||||||||||
333 | - | |||||||||||||
334 | - | |||||||||||||
335 | - | |||||||||||||
336 | - | |||||||||||||
337 | - | |||||||||||||
338 | - | |||||||||||||
339 | QString QPrinter::printerName() const | - | ||||||||||||
340 | { | - | ||||||||||||
341 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
342 | 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 | ||||||||||||
343 | } | - | ||||||||||||
344 | void QPrinter::setPrinterName(const QString &name) | - | ||||||||||||
345 | { | - | ||||||||||||
346 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
347 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-5 | ||||||||||||
348 | - | |||||||||||||
349 | if (printerName() == name
| 1-4 | ||||||||||||
350 | return; executed 4 times by 1 test: return; Executed by:
| 4 | ||||||||||||
351 | - | |||||||||||||
352 | if (name.isEmpty()
| 0-1 | ||||||||||||
353 | setOutputFormat(QPrinter::PdfFormat); | - | ||||||||||||
354 | return; never executed: return; | 0 | ||||||||||||
355 | } | - | ||||||||||||
356 | - | |||||||||||||
357 | QPrinterInfo printerToUse = QPrinterInfo::printerInfo(name); | - | ||||||||||||
358 | if (printerToUse.isNull()
| 0-1 | ||||||||||||
359 | return; executed 1 time by 1 test: return; Executed by:
| 1 | ||||||||||||
360 | - | |||||||||||||
361 | if (outputFormat() == QPrinter::PdfFormat
| 0 | ||||||||||||
362 | d->changeEngines(QPrinter::NativeFormat, printerToUse); | - | ||||||||||||
363 | } never executed: else {end of block | 0 | ||||||||||||
364 | d->setProperty(QPrintEngine::PPK_PrinterName, name); | - | ||||||||||||
365 | } never executed: end of block | 0 | ||||||||||||
366 | } | - | ||||||||||||
367 | bool QPrinter::isValid() const | - | ||||||||||||
368 | { | - | ||||||||||||
369 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
370 | if (!QCoreApplication::instance()
| 0-3 | ||||||||||||
371 | return never executed: false;return false; never executed: return false; | 0 | ||||||||||||
372 | 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 | ||||||||||||
373 | } | - | ||||||||||||
374 | QString QPrinter::outputFileName() const | - | ||||||||||||
375 | { | - | ||||||||||||
376 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
377 | 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 | ||||||||||||
378 | } | - | ||||||||||||
379 | void QPrinter::setOutputFileName(const QString &fileName) | - | ||||||||||||
380 | { | - | ||||||||||||
381 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
382 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-39 | ||||||||||||
383 | - | |||||||||||||
384 | QFileInfo fi(fileName); | - | ||||||||||||
385 | if (!fi.suffix().compare(QLatin1String("pdf"), Qt::CaseInsensitive)
| 6-33 | ||||||||||||
386 | setOutputFormat(QPrinter::PdfFormat); executed 6 times by 1 test: setOutputFormat(QPrinter::PdfFormat); Executed by:
| 6 | ||||||||||||
387 | else if (fileName.isEmpty()
| 0-33 | ||||||||||||
388 | setOutputFormat(QPrinter::NativeFormat); never executed: setOutputFormat(QPrinter::NativeFormat); | 0 | ||||||||||||
389 | - | |||||||||||||
390 | d->setProperty(QPrintEngine::PPK_OutputFileName, fileName); | - | ||||||||||||
391 | } executed 39 times by 1 test: end of block Executed by:
| 39 | ||||||||||||
392 | QString QPrinter::printProgram() const | - | ||||||||||||
393 | { | - | ||||||||||||
394 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
395 | 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 | ||||||||||||
396 | } | - | ||||||||||||
397 | void QPrinter::setPrintProgram(const QString &printProg) | - | ||||||||||||
398 | { | - | ||||||||||||
399 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
400 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
401 | d->setProperty(QPrintEngine::PPK_PrinterProgram, printProg); | - | ||||||||||||
402 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
403 | - | |||||||||||||
404 | - | |||||||||||||
405 | - | |||||||||||||
406 | - | |||||||||||||
407 | - | |||||||||||||
408 | - | |||||||||||||
409 | - | |||||||||||||
410 | QString QPrinter::docName() const | - | ||||||||||||
411 | { | - | ||||||||||||
412 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
413 | 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 | ||||||||||||
414 | } | - | ||||||||||||
415 | void QPrinter::setDocName(const QString &name) | - | ||||||||||||
416 | { | - | ||||||||||||
417 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
418 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-2 | ||||||||||||
419 | d->setProperty(QPrintEngine::PPK_DocumentName, name); | - | ||||||||||||
420 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
421 | - | |||||||||||||
422 | - | |||||||||||||
423 | - | |||||||||||||
424 | - | |||||||||||||
425 | - | |||||||||||||
426 | - | |||||||||||||
427 | - | |||||||||||||
428 | QString QPrinter::creator() const | - | ||||||||||||
429 | { | - | ||||||||||||
430 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
431 | 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 | ||||||||||||
432 | } | - | ||||||||||||
433 | void QPrinter::setCreator(const QString &creator) | - | ||||||||||||
434 | { | - | ||||||||||||
435 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
436 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
437 | d->setProperty(QPrintEngine::PPK_Creator, creator); | - | ||||||||||||
438 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
439 | QPrinter::Orientation QPrinter::orientation() const | - | ||||||||||||
440 | { | - | ||||||||||||
441 | 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 | ||||||||||||
442 | } | - | ||||||||||||
443 | void QPrinter::setOrientation(Orientation orientation) | - | ||||||||||||
444 | { | - | ||||||||||||
445 | setPageOrientation(QPageLayout::Orientation(orientation)); | - | ||||||||||||
446 | } executed 48 times by 1 test: end of block Executed by:
| 48 | ||||||||||||
447 | QPrinter::PaperSize QPrinter::paperSize() const | - | ||||||||||||
448 | { | - | ||||||||||||
449 | return executed 2 times by 1 test: pageSize();return pageSize(); Executed by:
executed 2 times by 1 test: return pageSize(); Executed by:
| 2 | ||||||||||||
450 | } | - | ||||||||||||
451 | void QPrinter::setPaperSize(PaperSize newPaperSize) | - | ||||||||||||
452 | { | - | ||||||||||||
453 | setPageSize(QPageSize(QPageSize::PageSizeId(newPaperSize))); | - | ||||||||||||
454 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
455 | QPrinter::PageSize QPrinter::pageSize() const | - | ||||||||||||
456 | { | - | ||||||||||||
457 | 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 | ||||||||||||
458 | } | - | ||||||||||||
459 | void QPrinter::setPageSize(PageSize newPageSize) | - | ||||||||||||
460 | { | - | ||||||||||||
461 | setPageSize(QPageSize(QPageSize::PageSizeId(newPageSize))); | - | ||||||||||||
462 | } executed 31 times by 1 test: end of block Executed by:
| 31 | ||||||||||||
463 | void QPrinter::setPaperSize(const QSizeF &paperSize, QPrinter::Unit unit) | - | ||||||||||||
464 | { | - | ||||||||||||
465 | if (unit == QPrinter::DevicePixel
| 1-6 | ||||||||||||
466 | 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 | ||||||||||||
467 | else | - | ||||||||||||
468 | setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); executed 6 times by 1 test: setPageSize(QPageSize(paperSize, QPageSize::Unit(unit))); Executed by:
| 6 | ||||||||||||
469 | } | - | ||||||||||||
470 | void QPrinter::setPageSizeMM(const QSizeF &size) | - | ||||||||||||
471 | { | - | ||||||||||||
472 | setPageSize(QPageSize(size, QPageSize::Millimeter)); | - | ||||||||||||
473 | } executed 8 times by 1 test: end of block Executed by:
| 8 | ||||||||||||
474 | QSizeF QPrinter::paperSize(Unit unit) const | - | ||||||||||||
475 | { | - | ||||||||||||
476 | if (unit == QPrinter::DevicePixel
| 1-21 | ||||||||||||
477 | 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 | ||||||||||||
478 | else | - | ||||||||||||
479 | 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 | ||||||||||||
480 | } | - | ||||||||||||
481 | void QPrinter::setPaperName(const QString &paperName) | - | ||||||||||||
482 | { | - | ||||||||||||
483 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
484 | if (d->paintEngine->type() != QPaintEngine::Pdf
| 0 | ||||||||||||
485 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0 | ||||||||||||
486 | d->setProperty(QPrintEngine::PPK_PaperName, paperName); | - | ||||||||||||
487 | } never executed: end of block | 0 | ||||||||||||
488 | QString QPrinter::paperName() const | - | ||||||||||||
489 | { | - | ||||||||||||
490 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
491 | 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 | ||||||||||||
492 | } | - | ||||||||||||
493 | void QPrinter::setPageOrder(PageOrder pageOrder) | - | ||||||||||||
494 | { | - | ||||||||||||
495 | d->pageOrderAscending = (pageOrder == FirstPageFirst); | - | ||||||||||||
496 | - | |||||||||||||
497 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
498 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
499 | d->setProperty(QPrintEngine::PPK_PageOrder, pageOrder); | - | ||||||||||||
500 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
501 | QPrinter::PageOrder QPrinter::pageOrder() const | - | ||||||||||||
502 | { | - | ||||||||||||
503 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
504 | 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 | ||||||||||||
505 | } | - | ||||||||||||
506 | void QPrinter::setColorMode(ColorMode newColorMode) | - | ||||||||||||
507 | { | - | ||||||||||||
508 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
509 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
510 | d->setProperty(QPrintEngine::PPK_ColorMode, newColorMode); | - | ||||||||||||
511 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
512 | - | |||||||||||||
513 | - | |||||||||||||
514 | - | |||||||||||||
515 | - | |||||||||||||
516 | - | |||||||||||||
517 | - | |||||||||||||
518 | - | |||||||||||||
519 | QPrinter::ColorMode QPrinter::colorMode() const | - | ||||||||||||
520 | { | - | ||||||||||||
521 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
522 | 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 | ||||||||||||
523 | } | - | ||||||||||||
524 | int QPrinter::numCopies() const | - | ||||||||||||
525 | { | - | ||||||||||||
526 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
527 | 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 | ||||||||||||
528 | } | - | ||||||||||||
529 | int QPrinter::actualNumCopies() const | - | ||||||||||||
530 | { | - | ||||||||||||
531 | return executed 3 times by 1 test: copyCount();return copyCount(); Executed by:
executed 3 times by 1 test: return copyCount(); Executed by:
| 3 | ||||||||||||
532 | } | - | ||||||||||||
533 | void QPrinter::setNumCopies(int numCopies) | - | ||||||||||||
534 | { | - | ||||||||||||
535 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
536 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
537 | d->setProperty(QPrintEngine::PPK_NumberOfCopies, numCopies); | - | ||||||||||||
538 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
539 | void QPrinter::setCopyCount(int count) | - | ||||||||||||
540 | { | - | ||||||||||||
541 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
542 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
543 | d->setProperty(QPrintEngine::PPK_CopyCount, count); | - | ||||||||||||
544 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
545 | int QPrinter::copyCount() const | - | ||||||||||||
546 | { | - | ||||||||||||
547 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
548 | 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 | ||||||||||||
549 | } | - | ||||||||||||
550 | bool QPrinter::supportsMultipleCopies() const | - | ||||||||||||
551 | { | - | ||||||||||||
552 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
553 | 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 | ||||||||||||
554 | } | - | ||||||||||||
555 | bool QPrinter::collateCopies() const | - | ||||||||||||
556 | { | - | ||||||||||||
557 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
558 | 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 | ||||||||||||
559 | } | - | ||||||||||||
560 | void QPrinter::setCollateCopies(bool collate) | - | ||||||||||||
561 | { | - | ||||||||||||
562 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
563 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
564 | d->setProperty(QPrintEngine::PPK_CollateCopies, collate); | - | ||||||||||||
565 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
566 | void QPrinter::setFullPage(bool fp) | - | ||||||||||||
567 | { | - | ||||||||||||
568 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
569 | - | |||||||||||||
570 | d->setProperty(QPrintEngine::PPK_FullPage, fp); | - | ||||||||||||
571 | - | |||||||||||||
572 | devicePageLayout() = pageLayout(); | - | ||||||||||||
573 | } executed 19 times by 1 test: end of block Executed by:
| 19 | ||||||||||||
574 | bool QPrinter::fullPage() const | - | ||||||||||||
575 | { | - | ||||||||||||
576 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
577 | 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 | ||||||||||||
578 | } | - | ||||||||||||
579 | void QPrinter::setResolution(int dpi) | - | ||||||||||||
580 | { | - | ||||||||||||
581 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
582 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-27 | ||||||||||||
583 | d->setProperty(QPrintEngine::PPK_Resolution, dpi); | - | ||||||||||||
584 | } executed 27 times by 1 test: end of block Executed by:
| 27 | ||||||||||||
585 | int QPrinter::resolution() const | - | ||||||||||||
586 | { | - | ||||||||||||
587 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
588 | 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 | ||||||||||||
589 | } | - | ||||||||||||
590 | void QPrinter::setPaperSource(PaperSource source) | - | ||||||||||||
591 | { | - | ||||||||||||
592 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
593 | d->setProperty(QPrintEngine::PPK_PaperSource, source); | - | ||||||||||||
594 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
595 | - | |||||||||||||
596 | - | |||||||||||||
597 | - | |||||||||||||
598 | - | |||||||||||||
599 | - | |||||||||||||
600 | QPrinter::PaperSource QPrinter::paperSource() const | - | ||||||||||||
601 | { | - | ||||||||||||
602 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
603 | 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 | ||||||||||||
604 | } | - | ||||||||||||
605 | void QPrinter::setFontEmbeddingEnabled(bool enable) | - | ||||||||||||
606 | { | - | ||||||||||||
607 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
608 | d->setProperty(QPrintEngine::PPK_FontEmbedding, enable); | - | ||||||||||||
609 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
610 | bool QPrinter::fontEmbeddingEnabled() const | - | ||||||||||||
611 | { | - | ||||||||||||
612 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
613 | 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 | ||||||||||||
614 | } | - | ||||||||||||
615 | void QPrinter::setDoubleSidedPrinting(bool doubleSided) | - | ||||||||||||
616 | { | - | ||||||||||||
617 | setDuplex(doubleSided ? DuplexAuto : DuplexNone); | - | ||||||||||||
618 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
619 | bool QPrinter::doubleSidedPrinting() const | - | ||||||||||||
620 | { | - | ||||||||||||
621 | 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 | ||||||||||||
622 | } | - | ||||||||||||
623 | void QPrinter::setDuplex(DuplexMode duplex) | - | ||||||||||||
624 | { | - | ||||||||||||
625 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
626 | d->setProperty(QPrintEngine::PPK_Duplex, duplex); | - | ||||||||||||
627 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||
628 | QPrinter::DuplexMode QPrinter::duplex() const | - | ||||||||||||
629 | { | - | ||||||||||||
630 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
631 | 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 | ||||||||||||
632 | } | - | ||||||||||||
633 | QRectF QPrinter::pageRect(Unit unit) const | - | ||||||||||||
634 | { | - | ||||||||||||
635 | if (unit == QPrinter::DevicePixel
| 4-18 | ||||||||||||
636 | 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 | ||||||||||||
637 | else | - | ||||||||||||
638 | 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 | ||||||||||||
639 | } | - | ||||||||||||
640 | QRectF QPrinter::paperRect(Unit unit) const | - | ||||||||||||
641 | { | - | ||||||||||||
642 | if (unit == QPrinter::DevicePixel
| 0-18 | ||||||||||||
643 | return never executed: pageLayout().fullRectPixels(resolution());return pageLayout().fullRectPixels(resolution()); never executed: return pageLayout().fullRectPixels(resolution()); | 0 | ||||||||||||
644 | else | - | ||||||||||||
645 | 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 | ||||||||||||
646 | } | - | ||||||||||||
647 | QRect QPrinter::pageRect() const | - | ||||||||||||
648 | { | - | ||||||||||||
649 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
650 | 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 | ||||||||||||
651 | } | - | ||||||||||||
652 | QRect QPrinter::paperRect() const | - | ||||||||||||
653 | { | - | ||||||||||||
654 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
655 | 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 | ||||||||||||
656 | } | - | ||||||||||||
657 | void QPrinter::setPageMargins(qreal left, qreal top, qreal right, qreal bottom, QPrinter::Unit unit) | - | ||||||||||||
658 | { | - | ||||||||||||
659 | if (unit == QPrinter::DevicePixel
| 0-10 | ||||||||||||
660 | QMarginsF margins = QMarginsF(left, top, right, bottom); | - | ||||||||||||
661 | margins *= qt_pixelMultiplier(resolution()); | - | ||||||||||||
662 | margins = qt_convertMargins(margins, QPageLayout::Point, pageLayout().units()); | - | ||||||||||||
663 | setPageMargins(margins, pageLayout().units()); | - | ||||||||||||
664 | } never executed: else {end of block | 0 | ||||||||||||
665 | setPageMargins(QMarginsF(left, top, right, bottom), QPageLayout::Unit(unit)); | - | ||||||||||||
666 | } executed 10 times by 1 test: end of block Executed by:
| 10 | ||||||||||||
667 | } | - | ||||||||||||
668 | void QPrinter::setMargins(const Margins &m) | - | ||||||||||||
669 | { | - | ||||||||||||
670 | setPageMargins(QMarginsF(m.left, m.top, m.right, m.bottom), QPageLayout::Millimeter); | - | ||||||||||||
671 | } executed 3 times by 1 test: end of block Executed by:
| 3 | ||||||||||||
672 | void QPrinter::getPageMargins(qreal *left, qreal *top, qreal *right, qreal *bottom, QPrinter::Unit unit) const | - | ||||||||||||
673 | { | - | ||||||||||||
674 | QMarginsF margins; | - | ||||||||||||
675 | if (unit == QPrinter::DevicePixel
| 0-42 | ||||||||||||
676 | QMargins tmp = pageLayout().marginsPixels(resolution()); | - | ||||||||||||
677 | margins = QMarginsF(tmp.left(), tmp.top(), tmp.right(), tmp.bottom()); | - | ||||||||||||
678 | } never executed: else {end of block | 0 | ||||||||||||
679 | margins = pageLayout().margins(QPageLayout::Unit(unit)); | - | ||||||||||||
680 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||
681 | if (left
| 0-42 | ||||||||||||
682 | * 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 | ||||||||||||
683 | if (right
| 0-42 | ||||||||||||
684 | * 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 | ||||||||||||
685 | if (top
| 0-42 | ||||||||||||
686 | * 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 | ||||||||||||
687 | if (bottom
| 0-42 | ||||||||||||
688 | * 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 | ||||||||||||
689 | } executed 42 times by 1 test: end of block Executed by:
| 42 | ||||||||||||
690 | - | |||||||||||||
691 | - | |||||||||||||
692 | - | |||||||||||||
693 | - | |||||||||||||
694 | - | |||||||||||||
695 | - | |||||||||||||
696 | int QPrinter::metric(PaintDeviceMetric id) const | - | ||||||||||||
697 | { | - | ||||||||||||
698 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
699 | 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 | ||||||||||||
700 | } | - | ||||||||||||
701 | - | |||||||||||||
702 | - | |||||||||||||
703 | - | |||||||||||||
704 | - | |||||||||||||
705 | QPaintEngine *QPrinter::paintEngine() const | - | ||||||||||||
706 | { | - | ||||||||||||
707 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
708 | 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 | ||||||||||||
709 | } | - | ||||||||||||
710 | - | |||||||||||||
711 | - | |||||||||||||
712 | - | |||||||||||||
713 | - | |||||||||||||
714 | - | |||||||||||||
715 | - | |||||||||||||
716 | QPrintEngine *QPrinter::printEngine() const | - | ||||||||||||
717 | { | - | ||||||||||||
718 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
719 | return never executed: d->printEngine;return d->printEngine; never executed: return d->printEngine; | 0 | ||||||||||||
720 | } | - | ||||||||||||
721 | void QPrinter::setWinPageSize(int pageSize) | - | ||||||||||||
722 | { | - | ||||||||||||
723 | QPrinterPrivate * const d = d_func(); | - | ||||||||||||
724 | if (d->printEngine->printerState() == QPrinter::Active
never executed: };return; | 0-1 | ||||||||||||
725 | d->setProperty(QPrintEngine::PPK_WindowsPageSize, pageSize); | - | ||||||||||||
726 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||
727 | int QPrinter::winPageSize() const | - | ||||||||||||
728 | { | - | ||||||||||||
729 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
730 | 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 | ||||||||||||
731 | } | - | ||||||||||||
732 | QList<int> QPrinter::supportedResolutions() const | - | ||||||||||||
733 | { | - | ||||||||||||
734 | const QPrinterPrivate * const d = d_func(); | - | ||||||||||||
735 | QList<QVariant> varlist | - | ||||||||||||
736 | = d->printEngine->property(QPrintEngine::PPK_SupportedResolutions).toList(); | - | ||||||||||||
737 | QList<int> intlist; | - | ||||||||||||
738 | const int numSupportedResolutions = varlist.size(); | - | ||||||||||||
739 | intlist.reserve(numSupportedResolutions); | - | ||||||||||||
740 | for (int i = 0; i < numSupportedResolutions
| 1 | ||||||||||||
741 | intlist << varlist.at(i).toInt(); executed 1 time by 1 test: intlist << varlist.at(i).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__, 2131, __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 |