| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/printsupport/dialogs/qabstractprintdialog.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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
| 0-3 | ||||||||||||
| 19 | } executed 3 times by 1 test: end of blockExecuted by:
| 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 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||
| 33 | - | |||||||||||||
| 34 | - | |||||||||||||
| 35 | - | |||||||||||||
| 36 | - | |||||||||||||
| 37 | QAbstractPrintDialog::~QAbstractPrintDialog() | - | ||||||||||||
| 38 | { | - | ||||||||||||
| 39 | QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 40 | if (d->ownsPrinter
| 1-5 | ||||||||||||
| 41 | delete d->printer; executed 1 time by 1 test: delete d->printer;Executed by:
| 1 | ||||||||||||
| 42 | } executed 6 times by 2 tests: end of blockExecuted by:
| 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
| 0-1 | ||||||||||||
| 54 | setOptions(d->options ^ option); executed 1 time by 1 test: setOptions(d->options ^ option);Executed by:
| 1 | ||||||||||||
| 55 | } executed 1 time by 1 test: end of blockExecuted by:
| 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 never executed: (d->options & option) != 0;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
| 0-1 | ||||||||||||
| 74 | return; never executed: return; | 0 | ||||||||||||
| 75 | - | |||||||||||||
| 76 | d->options = options; | - | ||||||||||||
| 77 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 78 | - | |||||||||||||
| 79 | QPrintDialog::PrintDialogOptions QPrintDialog::options() const | - | ||||||||||||
| 80 | { | - | ||||||||||||
| 81 | const QPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 82 | return never executed: d->options;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 10 times by 2 tests: end of blockExecuted by:
| 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 | } never executed: end of block | 0 | ||||||||||||
| 106 | - | |||||||||||||
| 107 | - | |||||||||||||
| 108 | - | |||||||||||||
| 109 | - | |||||||||||||
| 110 | - | |||||||||||||
| 111 | - | |||||||||||||
| 112 | QAbstractPrintDialog::PrintDialogOptions QAbstractPrintDialog::enabledOptions() const | - | ||||||||||||
| 113 | { | - | ||||||||||||
| 114 | const QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 115 | return executed 5 times by 1 test: d->options;return d->options;Executed by:
executed 5 times by 1 test: return d->options;Executed by:
| 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 executed 27 times by 1 test: d->options & option;return d->options & option;Executed by:
executed 27 times by 1 test: return d->options & option;Executed by:
| 27 | ||||||||||||
| 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 3 times by 1 test: end of blockExecuted by:
| 3 | ||||||||||||
| 137 | - | |||||||||||||
| 138 | - | |||||||||||||
| 139 | - | |||||||||||||
| 140 | - | |||||||||||||
| 141 | QAbstractPrintDialog::PrintRange QAbstractPrintDialog::printRange() const | - | ||||||||||||
| 142 | { | - | ||||||||||||
| 143 | const QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 144 | return executed 4 times by 2 tests: QAbstractPrintDialog::PrintRange(d->pd->printRange);return QAbstractPrintDialog::PrintRange(d->pd->printRange);Executed by:
executed 4 times by 2 tests: return QAbstractPrintDialog::PrintRange(d->pd->printRange);Executed by:
| 4 | ||||||||||||
| 145 | } | - | ||||||||||||
| 146 | - | |||||||||||||
| 147 | - | |||||||||||||
| 148 | - | |||||||||||||
| 149 | - | |||||||||||||
| 150 | - | |||||||||||||
| 151 | void QAbstractPrintDialog::setMinMax(int min, int max) | - | ||||||||||||
| 152 | { | - | ||||||||||||
| 153 | QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 154 | ((!(min <= max)) ? qt_assert_x("QAbstractPrintDialog::setMinMax", "'min' must be less than or equal to 'max'", | - | ||||||||||||
| 155 | __FILE__ | - | ||||||||||||
| 156 | , | - | ||||||||||||
| 157 | 267 | - | ||||||||||||
| 158 | ) : qt_noop()) | - | ||||||||||||
| 159 | ; | - | ||||||||||||
| 160 | d->minPage = min; | - | ||||||||||||
| 161 | d->maxPage = max; | - | ||||||||||||
| 162 | d->options |= PrintPageRange; | - | ||||||||||||
| 163 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||
| 164 | - | |||||||||||||
| 165 | - | |||||||||||||
| 166 | - | |||||||||||||
| 167 | - | |||||||||||||
| 168 | - | |||||||||||||
| 169 | int QAbstractPrintDialog::minPage() const | - | ||||||||||||
| 170 | { | - | ||||||||||||
| 171 | const QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 172 | return executed 4 times by 2 tests: d->minPage;return d->minPage;Executed by:
executed 4 times by 2 tests: return d->minPage;Executed by:
| 4 | ||||||||||||
| 173 | } | - | ||||||||||||
| 174 | - | |||||||||||||
| 175 | - | |||||||||||||
| 176 | - | |||||||||||||
| 177 | - | |||||||||||||
| 178 | - | |||||||||||||
| 179 | - | |||||||||||||
| 180 | int QAbstractPrintDialog::maxPage() const | - | ||||||||||||
| 181 | { | - | ||||||||||||
| 182 | const QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 183 | return executed 4 times by 2 tests: d->maxPage;return d->maxPage;Executed by:
executed 4 times by 2 tests: return d->maxPage;Executed by:
| 4 | ||||||||||||
| 184 | } | - | ||||||||||||
| 185 | - | |||||||||||||
| 186 | - | |||||||||||||
| 187 | - | |||||||||||||
| 188 | - | |||||||||||||
| 189 | void QAbstractPrintDialog::setFromTo(int from, int to) | - | ||||||||||||
| 190 | { | - | ||||||||||||
| 191 | QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 192 | ((!(from <= to)) ? qt_assert_x("QAbstractPrintDialog::setFromTo", "'from' must be less than or equal to 'to'", | - | ||||||||||||
| 193 | __FILE__ | - | ||||||||||||
| 194 | , | - | ||||||||||||
| 195 | 301 | - | ||||||||||||
| 196 | ) : qt_noop()) | - | ||||||||||||
| 197 | ; | - | ||||||||||||
| 198 | d->printer->setFromTo(from, to); | - | ||||||||||||
| 199 | - | |||||||||||||
| 200 | if (d->minPage == 0
| 0-1 | ||||||||||||
| 201 | setMinMax(1, to); executed 1 time by 1 test: setMinMax(1, to);Executed by:
| 1 | ||||||||||||
| 202 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 203 | - | |||||||||||||
| 204 | - | |||||||||||||
| 205 | - | |||||||||||||
| 206 | - | |||||||||||||
| 207 | - | |||||||||||||
| 208 | int QAbstractPrintDialog::fromPage() const | - | ||||||||||||
| 209 | { | - | ||||||||||||
| 210 | const QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 211 | return executed 3 times by 2 tests: d->printer->fromPage();return d->printer->fromPage();Executed by:
executed 3 times by 2 tests: return d->printer->fromPage();Executed by:
| 3 | ||||||||||||
| 212 | } | - | ||||||||||||
| 213 | - | |||||||||||||
| 214 | - | |||||||||||||
| 215 | - | |||||||||||||
| 216 | - | |||||||||||||
| 217 | - | |||||||||||||
| 218 | int QAbstractPrintDialog::toPage() const | - | ||||||||||||
| 219 | { | - | ||||||||||||
| 220 | const QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 221 | return executed 3 times by 2 tests: d->printer->toPage();return d->printer->toPage();Executed by:
executed 3 times by 2 tests: return d->printer->toPage();Executed by:
| 3 | ||||||||||||
| 222 | } | - | ||||||||||||
| 223 | - | |||||||||||||
| 224 | - | |||||||||||||
| 225 | - | |||||||||||||
| 226 | - | |||||||||||||
| 227 | - | |||||||||||||
| 228 | - | |||||||||||||
| 229 | QPrinter *QAbstractPrintDialog::printer() const | - | ||||||||||||
| 230 | { | - | ||||||||||||
| 231 | const QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 232 | return executed 9 times by 2 tests: d->printer;return d->printer;Executed by:
executed 9 times by 2 tests: return d->printer;Executed by:
| 9 | ||||||||||||
| 233 | } | - | ||||||||||||
| 234 | - | |||||||||||||
| 235 | void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter) | - | ||||||||||||
| 236 | { | - | ||||||||||||
| 237 | if (newPrinter
| 1-5 | ||||||||||||
| 238 | printer = newPrinter; | - | ||||||||||||
| 239 | ownsPrinter = false; | - | ||||||||||||
| 240 | if (printer->fromPage()
| 0-4 | ||||||||||||
| 241 | options |= QAbstractPrintDialog::PrintPageRange; executed 1 time by 1 test: options |= QAbstractPrintDialog::PrintPageRange;Executed by:
| 1 | ||||||||||||
| 242 | } executed 5 times by 2 tests: else {end of blockExecuted by:
| 5 | ||||||||||||
| 243 | printer = new QPrinter; | - | ||||||||||||
| 244 | ownsPrinter = true; | - | ||||||||||||
| 245 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||
| 246 | pd = printer->d_func(); | - | ||||||||||||
| 247 | } executed 6 times by 2 tests: end of blockExecuted by:
| 6 | ||||||||||||
| 248 | void QAbstractPrintDialog::setOptionTabs(const QList<QWidget*> &tabs) | - | ||||||||||||
| 249 | { | - | ||||||||||||
| 250 | QAbstractPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 251 | d->setTabs(tabs); | - | ||||||||||||
| 252 | } never executed: end of block | 0 | ||||||||||||
| 253 | void QPrintDialog::done(int result) | - | ||||||||||||
| 254 | { | - | ||||||||||||
| 255 | QPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 256 | QDialog::done(result); | - | ||||||||||||
| 257 | if (result == Accepted
| 0 | ||||||||||||
| 258 | accepted(printer()); never executed: accepted(printer()); | 0 | ||||||||||||
| 259 | if (d->receiverToDisconnectOnClose
| 0 | ||||||||||||
| 260 | disconnect(this, qFlagLocation("2""accepted(QPrinter*)" "\0" __FILE__ ":" "474"), | - | ||||||||||||
| 261 | d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose); | - | ||||||||||||
| 262 | d->receiverToDisconnectOnClose = 0; | - | ||||||||||||
| 263 | } never executed: end of block | 0 | ||||||||||||
| 264 | d->memberToDisconnectOnClose.clear(); | - | ||||||||||||
| 265 | } never executed: end of block | 0 | ||||||||||||
| 266 | void QPrintDialog::open(QObject *receiver, const char *member) | - | ||||||||||||
| 267 | { | - | ||||||||||||
| 268 | QPrintDialogPrivate * const d = d_func(); | - | ||||||||||||
| 269 | connect(this, qFlagLocation("2""accepted(QPrinter*)" "\0" __FILE__ ":" "493"), receiver, member); | - | ||||||||||||
| 270 | d->receiverToDisconnectOnClose = receiver; | - | ||||||||||||
| 271 | d->memberToDisconnectOnClose = member; | - | ||||||||||||
| 272 | QDialog::open(); | - | ||||||||||||
| 273 | } never executed: end of block | 0 | ||||||||||||
| 274 | - | |||||||||||||
| 275 | - | |||||||||||||
| Switch to Source code | Preprocessed file |