Line | Source Code | Coverage |
---|
1 | | - |
2 | | - |
3 | | - |
4 | | - |
5 | | - |
6 | | - |
7 | class QPrintDialogPrivate : public QAbstractPrintDialogPrivate | - |
8 | { | - |
9 | }; | - |
10 | QAbstractPrintDialog::QAbstractPrintDialog(QPrinter *printer, QWidget *parent) | - |
11 | : QDialog(*(new QAbstractPrintDialogPrivate), parent) | - |
12 | { | - |
13 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
14 | setWindowTitle(QCoreApplication::translate("QPrintDialog", "Print")); | - |
15 | d->setPrinter(printer); | - |
16 | d->minPage = printer->fromPage(); | - |
17 | int to = printer->toPage(); | - |
18 | d->maxPage = to > 0 ? to : 2147483647; partially evaluated: to > 0 no Evaluation Count:0 | yes Evaluation Count:3 |
| 0-3 |
19 | } executed: } Execution Count:3 | 3 |
20 | | - |
21 | | - |
22 | | - |
23 | | - |
24 | QAbstractPrintDialog::QAbstractPrintDialog(QAbstractPrintDialogPrivate &ptr, | - |
25 | QPrinter *printer, | - |
26 | QWidget *parent) | - |
27 | : QDialog(ptr, parent) | - |
28 | { | - |
29 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
30 | setWindowTitle(QCoreApplication::translate("QPrintDialog", "Print")); | - |
31 | d->setPrinter(printer); | - |
32 | } executed: } Execution Count:3 | 3 |
33 | | - |
34 | | - |
35 | | - |
36 | | - |
37 | QAbstractPrintDialog::~QAbstractPrintDialog() | - |
38 | { | - |
39 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
40 | if (d->ownsPrinter) evaluated: d->ownsPrinter yes Evaluation Count:1 | yes Evaluation Count:5 |
| 1-5 |
41 | delete d->printer; executed: delete d->printer; Execution Count:1 | 1 |
42 | } executed: } Execution Count:6 | 6 |
43 | | - |
44 | | - |
45 | | - |
46 | | - |
47 | | - |
48 | | - |
49 | | - |
50 | void QPrintDialog::setOption(PrintDialogOption option, bool on) | - |
51 | { | - |
52 | QPrintDialogPrivate * const d = d_func(); | - |
53 | if (!(d->options & option) != !on) partially evaluated: !(d->options & option) != !on yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
54 | setOptions(d->options ^ option); executed: setOptions(d->options ^ option); Execution Count:1 | 1 |
55 | } executed: } Execution Count:1 | 1 |
56 | | - |
57 | | - |
58 | | - |
59 | | - |
60 | | - |
61 | | - |
62 | | - |
63 | bool QPrintDialog::testOption(PrintDialogOption option) const | - |
64 | { | - |
65 | const QPrintDialogPrivate * const d = d_func(); | - |
66 | return (d->options & option) != 0; never executed: return (d->options & option) != 0; | 0 |
67 | } | - |
68 | void QPrintDialog::setOptions(PrintDialogOptions options) | - |
69 | { | - |
70 | QPrintDialogPrivate * const d = d_func(); | - |
71 | | - |
72 | PrintDialogOptions changed = (options ^ d->options); | - |
73 | if (!changed) partially evaluated: !changed no Evaluation Count:0 | yes Evaluation Count:1 |
| 0-1 |
74 | return; | 0 |
75 | | - |
76 | d->options = options; | - |
77 | } executed: } Execution Count:1 | 1 |
78 | | - |
79 | QPrintDialog::PrintDialogOptions QPrintDialog::options() const | - |
80 | { | - |
81 | const QPrintDialogPrivate * const d = d_func(); | - |
82 | return d->options; never executed: return d->options; | 0 |
83 | } | - |
84 | | - |
85 | | - |
86 | | - |
87 | | - |
88 | | - |
89 | | - |
90 | void QAbstractPrintDialog::setEnabledOptions(PrintDialogOptions options) | - |
91 | { | - |
92 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
93 | d->options = options; | - |
94 | } executed: } Execution Count:10 | 10 |
95 | | - |
96 | | - |
97 | | - |
98 | | - |
99 | | - |
100 | | - |
101 | void QAbstractPrintDialog::addEnabledOption(PrintDialogOption option) | - |
102 | { | - |
103 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
104 | d->options |= option; | - |
105 | } | 0 |
106 | | - |
107 | | - |
108 | | - |
109 | | - |
110 | | - |
111 | | - |
112 | QAbstractPrintDialog::PrintDialogOptions QAbstractPrintDialog::enabledOptions() const | - |
113 | { | - |
114 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
115 | return d->options; executed: return d->options; Execution Count:5 | 5 |
116 | } | - |
117 | | - |
118 | | - |
119 | | - |
120 | | - |
121 | | - |
122 | | - |
123 | bool QAbstractPrintDialog::isOptionEnabled(PrintDialogOption option) const | - |
124 | { | - |
125 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
126 | return d->options & option; executed: return d->options & option; Execution Count:23 | 23 |
127 | } | - |
128 | | - |
129 | | - |
130 | | - |
131 | | - |
132 | void QAbstractPrintDialog::setPrintRange(PrintRange range) | - |
133 | { | - |
134 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
135 | d->printer->setPrintRange(QPrinter::PrintRange(range)); | - |
136 | } executed: } Execution Count:3 | 3 |
137 | | - |
138 | | - |
139 | | - |
140 | | - |
141 | QAbstractPrintDialog::PrintRange QAbstractPrintDialog::printRange() const | - |
142 | { | - |
143 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
144 | return QAbstractPrintDialog::PrintRange(d->pd->printRange); executed: return QAbstractPrintDialog::PrintRange(d->pd->printRange); Execution Count:4 | 4 |
145 | } | - |
146 | | - |
147 | | - |
148 | | - |
149 | | - |
150 | | - |
151 | void QAbstractPrintDialog::setMinMax(int min, int max) | - |
152 | { | - |
153 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
154 | qt_noop(); | - |
155 | | - |
156 | d->minPage = min; | - |
157 | d->maxPage = max; | - |
158 | d->options |= PrintPageRange; | - |
159 | } executed: } Execution Count:2 | 2 |
160 | | - |
161 | | - |
162 | | - |
163 | | - |
164 | | - |
165 | int QAbstractPrintDialog::minPage() const | - |
166 | { | - |
167 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
168 | return d->minPage; executed: return d->minPage; Execution Count:4 | 4 |
169 | } | - |
170 | | - |
171 | | - |
172 | | - |
173 | | - |
174 | | - |
175 | | - |
176 | int QAbstractPrintDialog::maxPage() const | - |
177 | { | - |
178 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
179 | return d->maxPage; executed: return d->maxPage; Execution Count:4 | 4 |
180 | } | - |
181 | | - |
182 | | - |
183 | | - |
184 | | - |
185 | void QAbstractPrintDialog::setFromTo(int from, int to) | - |
186 | { | - |
187 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
188 | qt_noop(); | - |
189 | | - |
190 | d->printer->setFromTo(from, to); | - |
191 | | - |
192 | if (d->minPage == 0 && d->maxPage == 0) partially evaluated: d->minPage == 0 yes Evaluation Count:1 | no Evaluation Count:0 |
partially evaluated: d->maxPage == 0 yes Evaluation Count:1 | no Evaluation Count:0 |
| 0-1 |
193 | setMinMax(1, to); executed: setMinMax(1, to); Execution Count:1 | 1 |
194 | } executed: } Execution Count:1 | 1 |
195 | | - |
196 | | - |
197 | | - |
198 | | - |
199 | | - |
200 | int QAbstractPrintDialog::fromPage() const | - |
201 | { | - |
202 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
203 | return d->printer->fromPage(); executed: return d->printer->fromPage(); Execution Count:3 | 3 |
204 | } | - |
205 | | - |
206 | | - |
207 | | - |
208 | | - |
209 | | - |
210 | int QAbstractPrintDialog::toPage() const | - |
211 | { | - |
212 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
213 | return d->printer->toPage(); executed: return d->printer->toPage(); Execution Count:3 | 3 |
214 | } | - |
215 | | - |
216 | | - |
217 | | - |
218 | | - |
219 | | - |
220 | | - |
221 | QPrinter *QAbstractPrintDialog::printer() const | - |
222 | { | - |
223 | const QAbstractPrintDialogPrivate * const d = d_func(); | - |
224 | return d->printer; executed: return d->printer; Execution Count:9 | 9 |
225 | } | - |
226 | | - |
227 | void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) | - |
228 | { | - |
229 | if (newPrinter) { evaluated: newPrinter yes Evaluation Count:5 | yes Evaluation Count:1 |
| 1-5 |
230 | printer = newPrinter; | - |
231 | ownsPrinter = false; | - |
232 | if (printer->fromPage() || printer->toPage()) evaluated: printer->fromPage() yes Evaluation Count:1 | yes Evaluation Count:4 |
partially evaluated: printer->toPage() no Evaluation Count:0 | yes Evaluation Count:4 |
| 0-4 |
233 | options |= QAbstractPrintDialog::PrintPageRange; executed: options |= QAbstractPrintDialog::PrintPageRange; Execution Count:1 | 1 |
234 | } else { executed: } Execution Count:5 | 5 |
235 | printer = new QPrinter; | - |
236 | ownsPrinter = true; | - |
237 | } executed: } Execution Count:1 | 1 |
238 | pd = printer->d_func(); | - |
239 | } executed: } Execution Count:6 | 6 |
240 | void QAbstractPrintDialog::setOptionTabs(const QList<QWidget*> &tabs) | - |
241 | { | - |
242 | QAbstractPrintDialogPrivate * const d = d_func(); | - |
243 | d->setTabs(tabs); | - |
244 | } | 0 |
245 | void QPrintDialog::done(int result) | - |
246 | { | - |
247 | QPrintDialogPrivate * const d = d_func(); | - |
248 | QDialog::done(result); | - |
249 | if (result == Accepted) never evaluated: result == Accepted | 0 |
250 | accepted(printer()); never executed: accepted(printer()); | 0 |
251 | if (d->receiverToDisconnectOnClose) { never evaluated: d->receiverToDisconnectOnClose | 0 |
252 | disconnect(this, "2""accepted(QPrinter*)", | - |
253 | d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); | - |
254 | d->receiverToDisconnectOnClose = 0; | - |
255 | } | 0 |
256 | d->memberToDisconnectOnClose.clear(); | - |
257 | } | 0 |
258 | void QPrintDialog::open(QObject *receiver, const char *member) | - |
259 | { | - |
260 | QPrintDialogPrivate * const d = d_func(); | - |
261 | connect(this, "2""accepted(QPrinter*)", receiver, member); | - |
262 | d->receiverToDisconnectOnClose = receiver; | - |
263 | d->memberToDisconnectOnClose = member; | - |
264 | QDialog::open(); | - |
265 | } | 0 |
266 | | - |
267 | | - |
268 | | - |
| | |