| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/printsupport/widgets/qprintpreviewwidget.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | - | |||||||||||||||||||
| 6 | - | |||||||||||||||||||
| 7 | namespace { | - | ||||||||||||||||||
| 8 | class PageItem : public QGraphicsItem | - | ||||||||||||||||||
| 9 | { | - | ||||||||||||||||||
| 10 | public: | - | ||||||||||||||||||
| 11 | PageItem(int _pageNum, const QPicture* _pagePicture, QSize _paperSize, QRect _pageRect) | - | ||||||||||||||||||
| 12 | : pageNum(_pageNum), pagePicture(_pagePicture), | - | ||||||||||||||||||
| 13 | paperSize(_paperSize), pageRect(_pageRect) | - | ||||||||||||||||||
| 14 | { | - | ||||||||||||||||||
| 15 | qreal border = qMax(paperSize.height(), paperSize.width()) / 25; | - | ||||||||||||||||||
| 16 | brect = QRectF(QPointF(-border, -border), | - | ||||||||||||||||||
| 17 | QSizeF(paperSize)+QSizeF(2*border, 2*border)); | - | ||||||||||||||||||
| 18 | setCacheMode(DeviceCoordinateCache); | - | ||||||||||||||||||
| 19 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | QRectF boundingRect() const override | - | ||||||||||||||||||
| 22 | { return executed 113 times by 1 test: brect;return brect;Executed by:
executed 113 times by 1 test: }return brect;Executed by:
| 113 | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | inline int pageNumber() const | - | ||||||||||||||||||
| 25 | { return executed 17 times by 1 test: pageNum;return pageNum;Executed by:
executed 17 times by 1 test: }return pageNum;Executed by:
| 17 | ||||||||||||||||||
| 26 | - | |||||||||||||||||||
| 27 | void paint(QPainter *painter, const QStyleOptionGraphicsItem *item, QWidget *widget) override; | - | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | private: | - | ||||||||||||||||||
| 30 | int pageNum; | - | ||||||||||||||||||
| 31 | const QPicture* pagePicture; | - | ||||||||||||||||||
| 32 | QSize paperSize; | - | ||||||||||||||||||
| 33 | QRect pageRect; | - | ||||||||||||||||||
| 34 | QRectF brect; | - | ||||||||||||||||||
| 35 | }; | - | ||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) | - | ||||||||||||||||||
| 38 | { | - | ||||||||||||||||||
| 39 | (void)widget;; | - | ||||||||||||||||||
| 40 | QRectF paperRect(0,0, paperSize.width(), paperSize.height()); | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | painter->setClipRect(option->exposedRect); | - | ||||||||||||||||||
| 44 | qreal shWidth = paperRect.width()/100; | - | ||||||||||||||||||
| 45 | QRectF rshadow(paperRect.topRight() + QPointF(0, shWidth), | - | ||||||||||||||||||
| 46 | paperRect.bottomRight() + QPointF(shWidth, 0)); | - | ||||||||||||||||||
| 47 | QLinearGradient rgrad(rshadow.topLeft(), rshadow.topRight()); | - | ||||||||||||||||||
| 48 | rgrad.setColorAt(0.0, QColor(0,0,0,255)); | - | ||||||||||||||||||
| 49 | rgrad.setColorAt(1.0, QColor(0,0,0,0)); | - | ||||||||||||||||||
| 50 | painter->fillRect(rshadow, QBrush(rgrad)); | - | ||||||||||||||||||
| 51 | QRectF bshadow(paperRect.bottomLeft() + QPointF(shWidth, 0), | - | ||||||||||||||||||
| 52 | paperRect.bottomRight() + QPointF(0, shWidth)); | - | ||||||||||||||||||
| 53 | QLinearGradient bgrad(bshadow.topLeft(), bshadow.bottomLeft()); | - | ||||||||||||||||||
| 54 | bgrad.setColorAt(0.0, QColor(0,0,0,255)); | - | ||||||||||||||||||
| 55 | bgrad.setColorAt(1.0, QColor(0,0,0,0)); | - | ||||||||||||||||||
| 56 | painter->fillRect(bshadow, QBrush(bgrad)); | - | ||||||||||||||||||
| 57 | QRectF cshadow(paperRect.bottomRight(), | - | ||||||||||||||||||
| 58 | paperRect.bottomRight() + QPointF(shWidth, shWidth)); | - | ||||||||||||||||||
| 59 | QRadialGradient cgrad(cshadow.topLeft(), shWidth, cshadow.topLeft()); | - | ||||||||||||||||||
| 60 | cgrad.setColorAt(0.0, QColor(0,0,0,255)); | - | ||||||||||||||||||
| 61 | cgrad.setColorAt(1.0, QColor(0,0,0,0)); | - | ||||||||||||||||||
| 62 | painter->fillRect(cshadow, QBrush(cgrad)); | - | ||||||||||||||||||
| 63 | - | |||||||||||||||||||
| 64 | painter->setClipRect(paperRect & option->exposedRect); | - | ||||||||||||||||||
| 65 | painter->fillRect(paperRect, Qt::white); | - | ||||||||||||||||||
| 66 | if (!pagePicture
| 0-2 | ||||||||||||||||||
| 67 | return; never executed: return; | 0 | ||||||||||||||||||
| 68 | painter->drawPicture(pageRect.topLeft(), *pagePicture); | - | ||||||||||||||||||
| 69 | - | |||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | QPainterPath path; | - | ||||||||||||||||||
| 72 | path.addRect(paperRect); | - | ||||||||||||||||||
| 73 | path.addRect(pageRect); | - | ||||||||||||||||||
| 74 | painter->setPen(QPen(Qt::NoPen)); | - | ||||||||||||||||||
| 75 | painter->setBrush(QColor(255, 255, 255, 180)); | - | ||||||||||||||||||
| 76 | painter->drawPath(path); | - | ||||||||||||||||||
| 77 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | class GraphicsView : public QGraphicsView | - | ||||||||||||||||||
| 80 | { | - | ||||||||||||||||||
| 81 | public: template <typename ThisObject> inline void qt_check_for_QOBJECT_macro(const ThisObject &_q_argument) const { int i = qYouForgotTheQ_OBJECT_Macro(this, &_q_argument); i = i + 1; } | - | ||||||||||||||||||
| 82 | #pragma GCC diagnostic push | - | ||||||||||||||||||
| 83 | static const QMetaObject staticMetaObject; virtual const QMetaObject *metaObject() const; virtual void *qt_metacast(const char *); virtual int qt_metacall(QMetaObject::Call, int, void **); static inline QString tr(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } __attribute__ ((__deprecated__)) static inline QString trUtf8(const char *s, const char *c = nullptr, int n = -1) { return staticMetaObject.tr(s, c, n); } private: __attribute__((visibility("hidden"))) static void qt_static_metacall(QObject *, QMetaObject::Call, int, void **); | - | ||||||||||||||||||
| 84 | #pragma GCC diagnostic pop | - | ||||||||||||||||||
| 85 | struct QPrivateSignal {}; | - | ||||||||||||||||||
| 86 | public: | - | ||||||||||||||||||
| 87 | GraphicsView(QWidget* parent = 0) | - | ||||||||||||||||||
| 88 | : QGraphicsView(parent) | - | ||||||||||||||||||
| 89 | { | - | ||||||||||||||||||
| 90 | - | |||||||||||||||||||
| 91 | - | |||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 94 | public : | - | ||||||||||||||||||
| 95 | void resized(); | - | ||||||||||||||||||
| 96 | - | |||||||||||||||||||
| 97 | protected: | - | ||||||||||||||||||
| 98 | void resizeEvent(QResizeEvent* e) override | - | ||||||||||||||||||
| 99 | { | - | ||||||||||||||||||
| 100 | { | - | ||||||||||||||||||
| 101 | const QSignalBlocker blocker(verticalScrollBar()); | - | ||||||||||||||||||
| 102 | QGraphicsView::resizeEvent(e); | - | ||||||||||||||||||
| 103 | } | - | ||||||||||||||||||
| 104 | resized(); | - | ||||||||||||||||||
| 105 | } executed 2 times by 1 test: end of blockExecuted by:
| 2 | ||||||||||||||||||
| 106 | - | |||||||||||||||||||
| 107 | void showEvent(QShowEvent* e) override | - | ||||||||||||||||||
| 108 | { | - | ||||||||||||||||||
| 109 | QGraphicsView::showEvent(e); | - | ||||||||||||||||||
| 110 | resized(); | - | ||||||||||||||||||
| 111 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 112 | }; | - | ||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | } | - | ||||||||||||||||||
| 115 | - | |||||||||||||||||||
| 116 | class QPrintPreviewWidgetPrivate : public QWidgetPrivate | - | ||||||||||||||||||
| 117 | { | - | ||||||||||||||||||
| 118 | inline QPrintPreviewWidget* q_func() { return static_cast<QPrintPreviewWidget *>(q_ptr); } inline const QPrintPreviewWidget* q_func() const { return static_cast<const QPrintPreviewWidget *>(q_ptr); } friend class QPrintPreviewWidget; | - | ||||||||||||||||||
| 119 | public: | - | ||||||||||||||||||
| 120 | QPrintPreviewWidgetPrivate() | - | ||||||||||||||||||
| 121 | : scene(0), curPage(1), | - | ||||||||||||||||||
| 122 | viewMode(QPrintPreviewWidget::SinglePageView), | - | ||||||||||||||||||
| 123 | zoomMode(QPrintPreviewWidget::FitInView), | - | ||||||||||||||||||
| 124 | zoomFactor(1), initialized(false), fitting(true) | - | ||||||||||||||||||
| 125 | {} executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 126 | - | |||||||||||||||||||
| 127 | - | |||||||||||||||||||
| 128 | void _q_fit(bool doFitting = false); | - | ||||||||||||||||||
| 129 | void _q_updateCurrentPage(); | - | ||||||||||||||||||
| 130 | - | |||||||||||||||||||
| 131 | void init(); | - | ||||||||||||||||||
| 132 | void populateScene(); | - | ||||||||||||||||||
| 133 | void layoutPages(); | - | ||||||||||||||||||
| 134 | void generatePreview(); | - | ||||||||||||||||||
| 135 | void setCurrentPage(int pageNumber); | - | ||||||||||||||||||
| 136 | void zoom(qreal zoom); | - | ||||||||||||||||||
| 137 | void setZoomFactor(qreal zoomFactor); | - | ||||||||||||||||||
| 138 | int calcCurrentPage(); | - | ||||||||||||||||||
| 139 | - | |||||||||||||||||||
| 140 | GraphicsView *graphicsView; | - | ||||||||||||||||||
| 141 | QGraphicsScene *scene; | - | ||||||||||||||||||
| 142 | - | |||||||||||||||||||
| 143 | int curPage; | - | ||||||||||||||||||
| 144 | QList<const QPicture *> pictures; | - | ||||||||||||||||||
| 145 | QList<QGraphicsItem *> pages; | - | ||||||||||||||||||
| 146 | - | |||||||||||||||||||
| 147 | QPrintPreviewWidget::ViewMode viewMode; | - | ||||||||||||||||||
| 148 | QPrintPreviewWidget::ZoomMode zoomMode; | - | ||||||||||||||||||
| 149 | qreal zoomFactor; | - | ||||||||||||||||||
| 150 | bool ownPrinter; | - | ||||||||||||||||||
| 151 | QPrinter* printer; | - | ||||||||||||||||||
| 152 | bool initialized; | - | ||||||||||||||||||
| 153 | bool fitting; | - | ||||||||||||||||||
| 154 | }; | - | ||||||||||||||||||
| 155 | - | |||||||||||||||||||
| 156 | void QPrintPreviewWidgetPrivate::_q_fit(bool doFitting) | - | ||||||||||||||||||
| 157 | { | - | ||||||||||||||||||
| 158 | QPrintPreviewWidget * const q = q_func(); | - | ||||||||||||||||||
| 159 | - | |||||||||||||||||||
| 160 | if (curPage < 1
| 0-4 | ||||||||||||||||||
| 161 | return; never executed: return; | 0 | ||||||||||||||||||
| 162 | - | |||||||||||||||||||
| 163 | if (!doFitting
| 0-4 | ||||||||||||||||||
| 164 | return; never executed: return; | 0 | ||||||||||||||||||
| 165 | - | |||||||||||||||||||
| 166 | if (doFitting
| 0-4 | ||||||||||||||||||
| 167 | QRect viewRect = graphicsView->viewport()->rect(); | - | ||||||||||||||||||
| 168 | if (zoomMode == QPrintPreviewWidget::FitInView
| 0 | ||||||||||||||||||
| 169 | const QList<QGraphicsItem*> containedItems = graphicsView->items(viewRect, Qt::ContainsItemBoundingRect); | - | ||||||||||||||||||
| 170 | for (QGraphicsItem* item : containedItems) { | - | ||||||||||||||||||
| 171 | PageItem* pg = static_cast<PageItem*>(item); | - | ||||||||||||||||||
| 172 | if (pg->pageNumber() == curPage
| 0 | ||||||||||||||||||
| 173 | return; never executed: return; | 0 | ||||||||||||||||||
| 174 | } never executed: end of block | 0 | ||||||||||||||||||
| 175 | } never executed: end of block | 0 | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | int newPage = calcCurrentPage(); | - | ||||||||||||||||||
| 178 | if (newPage != curPage
| 0 | ||||||||||||||||||
| 179 | curPage = newPage; never executed: curPage = newPage; | 0 | ||||||||||||||||||
| 180 | } never executed: end of block | 0 | ||||||||||||||||||
| 181 | - | |||||||||||||||||||
| 182 | QRectF target = pages.at(curPage-1)->sceneBoundingRect(); | - | ||||||||||||||||||
| 183 | if (viewMode == QPrintPreviewWidget::FacingPagesView
| 0-4 | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | if (curPage % 2
| 0 | ||||||||||||||||||
| 186 | target.setLeft(target.left() - target.width()); never executed: target.setLeft(target.left() - target.width()); | 0 | ||||||||||||||||||
| 187 | else | - | ||||||||||||||||||
| 188 | target.setRight(target.right() + target.width()); never executed: target.setRight(target.right() + target.width()); | 0 | ||||||||||||||||||
| 189 | } else if (viewMode == QPrintPreviewWidget::AllPagesView
| 0-4 | ||||||||||||||||||
| 190 | target = scene->itemsBoundingRect(); | - | ||||||||||||||||||
| 191 | } never executed: end of block | 0 | ||||||||||||||||||
| 192 | - | |||||||||||||||||||
| 193 | if (zoomMode == QPrintPreviewWidget::FitToWidth
| 0-4 | ||||||||||||||||||
| 194 | QTransform t; | - | ||||||||||||||||||
| 195 | qreal scale = graphicsView->viewport()->width() / target.width(); | - | ||||||||||||||||||
| 196 | t.scale(scale, scale); | - | ||||||||||||||||||
| 197 | graphicsView->setTransform(t); | - | ||||||||||||||||||
| 198 | if (doFitting
| 0 | ||||||||||||||||||
| 199 | QRectF viewSceneRect = graphicsView->viewportTransform().mapRect(graphicsView->viewport()->rect()); | - | ||||||||||||||||||
| 200 | viewSceneRect.moveTop(target.top()); | - | ||||||||||||||||||
| 201 | graphicsView->ensureVisible(viewSceneRect); | - | ||||||||||||||||||
| 202 | } never executed: end of block | 0 | ||||||||||||||||||
| 203 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 204 | graphicsView->fitInView(target, Qt::KeepAspectRatio); | - | ||||||||||||||||||
| 205 | if (zoomMode == QPrintPreviewWidget::FitInView
| 0-4 | ||||||||||||||||||
| 206 | int step = qRound(graphicsView->matrix().mapRect(target).height()); | - | ||||||||||||||||||
| 207 | graphicsView->verticalScrollBar()->setSingleStep(step); | - | ||||||||||||||||||
| 208 | graphicsView->verticalScrollBar()->setPageStep(step); | - | ||||||||||||||||||
| 209 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 210 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 211 | - | |||||||||||||||||||
| 212 | zoomFactor = graphicsView->transform().m11() * (float(printer->logicalDpiY()) / q->logicalDpiY()); | - | ||||||||||||||||||
| 213 | q->previewChanged(); | - | ||||||||||||||||||
| 214 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | void QPrintPreviewWidgetPrivate::_q_updateCurrentPage() | - | ||||||||||||||||||
| 217 | { | - | ||||||||||||||||||
| 218 | QPrintPreviewWidget * const q = q_func(); | - | ||||||||||||||||||
| 219 | - | |||||||||||||||||||
| 220 | if (viewMode == QPrintPreviewWidget::AllPagesView
| 0-11 | ||||||||||||||||||
| 221 | return; never executed: return; | 0 | ||||||||||||||||||
| 222 | - | |||||||||||||||||||
| 223 | int newPage = calcCurrentPage(); | - | ||||||||||||||||||
| 224 | if (newPage != curPage
| 3-8 | ||||||||||||||||||
| 225 | curPage = newPage; | - | ||||||||||||||||||
| 226 | q->previewChanged(); | - | ||||||||||||||||||
| 227 | } executed 8 times by 1 test: end of blockExecuted by:
| 8 | ||||||||||||||||||
| 228 | } executed 11 times by 1 test: end of blockExecuted by:
| 11 | ||||||||||||||||||
| 229 | - | |||||||||||||||||||
| 230 | int QPrintPreviewWidgetPrivate::calcCurrentPage() | - | ||||||||||||||||||
| 231 | { | - | ||||||||||||||||||
| 232 | int maxArea = 0; | - | ||||||||||||||||||
| 233 | int newPage = curPage; | - | ||||||||||||||||||
| 234 | QRect viewRect = graphicsView->viewport()->rect(); | - | ||||||||||||||||||
| 235 | const QList<QGraphicsItem*> items = graphicsView->items(viewRect); | - | ||||||||||||||||||
| 236 | for (auto *item : items) { | - | ||||||||||||||||||
| 237 | PageItem* pg = static_cast<PageItem*>(item); | - | ||||||||||||||||||
| 238 | QRect overlap = graphicsView->mapFromScene(pg->sceneBoundingRect()).boundingRect() & viewRect; | - | ||||||||||||||||||
| 239 | int area = overlap.width() * overlap.height(); | - | ||||||||||||||||||
| 240 | if (area > maxArea
| 3-17 | ||||||||||||||||||
| 241 | maxArea = area; | - | ||||||||||||||||||
| 242 | newPage = pg->pageNumber(); | - | ||||||||||||||||||
| 243 | } executed 17 times by 1 test: else if (area == maxAreaend of blockExecuted by:
| 0-17 | ||||||||||||||||||
| 244 | newPage = pg->pageNumber(); | - | ||||||||||||||||||
| 245 | } never executed: end of block | 0 | ||||||||||||||||||
| 246 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||||||||||||||
| 247 | return executed 11 times by 1 test: newPage;return newPage;Executed by:
executed 11 times by 1 test: return newPage;Executed by:
| 11 | ||||||||||||||||||
| 248 | } | - | ||||||||||||||||||
| 249 | - | |||||||||||||||||||
| 250 | void QPrintPreviewWidgetPrivate::init() | - | ||||||||||||||||||
| 251 | { | - | ||||||||||||||||||
| 252 | QPrintPreviewWidget * const q = q_func(); | - | ||||||||||||||||||
| 253 | - | |||||||||||||||||||
| 254 | graphicsView = new GraphicsView; | - | ||||||||||||||||||
| 255 | graphicsView->setInteractive(false); | - | ||||||||||||||||||
| 256 | graphicsView->setDragMode(QGraphicsView::ScrollHandDrag); | - | ||||||||||||||||||
| 257 | graphicsView->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); | - | ||||||||||||||||||
| 258 | QObject::connect(graphicsView->verticalScrollBar(), qFlagLocation("2""valueChanged(int)" "\0" __FILE__ ":" "321"), | - | ||||||||||||||||||
| 259 | q, qFlagLocation("1""_q_updateCurrentPage()" "\0" __FILE__ ":" "322")); | - | ||||||||||||||||||
| 260 | QObject::connect(graphicsView, qFlagLocation("2""resized()" "\0" __FILE__ ":" "323"), q, qFlagLocation("1""_q_fit()" "\0" __FILE__ ":" "323")); | - | ||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | scene = new QGraphicsScene(graphicsView); | - | ||||||||||||||||||
| 263 | scene->setBackgroundBrush(Qt::gray); | - | ||||||||||||||||||
| 264 | graphicsView->setScene(scene); | - | ||||||||||||||||||
| 265 | - | |||||||||||||||||||
| 266 | QVBoxLayout *layout = new QVBoxLayout; | - | ||||||||||||||||||
| 267 | q->setLayout(layout); | - | ||||||||||||||||||
| 268 | layout->setContentsMargins(0, 0, 0, 0); | - | ||||||||||||||||||
| 269 | layout->addWidget(graphicsView); | - | ||||||||||||||||||
| 270 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 271 | - | |||||||||||||||||||
| 272 | void QPrintPreviewWidgetPrivate::populateScene() | - | ||||||||||||||||||
| 273 | { | - | ||||||||||||||||||
| 274 | - | |||||||||||||||||||
| 275 | for (auto *page : qAsConst(pages)) | - | ||||||||||||||||||
| 276 | scene->removeItem(page); never executed: scene->removeItem(page); | 0 | ||||||||||||||||||
| 277 | qDeleteAll(pages); | - | ||||||||||||||||||
| 278 | pages.clear(); | - | ||||||||||||||||||
| 279 | - | |||||||||||||||||||
| 280 | QSize paperSize = printer->pageLayout().fullRectPixels(printer->resolution()).size(); | - | ||||||||||||||||||
| 281 | QRect pageRect = printer->pageLayout().paintRectPixels(printer->resolution()); | - | ||||||||||||||||||
| 282 | - | |||||||||||||||||||
| 283 | int page = 1; | - | ||||||||||||||||||
| 284 | for (auto *picture : qAsConst(pictures)) { | - | ||||||||||||||||||
| 285 | PageItem* item = new PageItem(page++, picture, paperSize, pageRect); | - | ||||||||||||||||||
| 286 | scene->addItem(item); | - | ||||||||||||||||||
| 287 | pages.append(item); | - | ||||||||||||||||||
| 288 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 289 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | void QPrintPreviewWidgetPrivate::layoutPages() | - | ||||||||||||||||||
| 292 | { | - | ||||||||||||||||||
| 293 | int numPages = pages.count(); | - | ||||||||||||||||||
| 294 | if (numPages < 1
| 0-1 | ||||||||||||||||||
| 295 | return; never executed: return; | 0 | ||||||||||||||||||
| 296 | - | |||||||||||||||||||
| 297 | int numPagePlaces = numPages; | - | ||||||||||||||||||
| 298 | int cols = 1; | - | ||||||||||||||||||
| 299 | if (viewMode == QPrintPreviewWidget::AllPagesView
| 0-1 | ||||||||||||||||||
| 300 | if (printer->orientation() == QPrinter::Portrait
| 0 | ||||||||||||||||||
| 301 | cols = qCeil(qSqrt((float) numPages)); never executed: cols = qCeil(qSqrt((float) numPages)); | 0 | ||||||||||||||||||
| 302 | else | - | ||||||||||||||||||
| 303 | cols = qFloor(qSqrt((float) numPages)); never executed: cols = qFloor(qSqrt((float) numPages)); | 0 | ||||||||||||||||||
| 304 | cols += cols % 2; | - | ||||||||||||||||||
| 305 | } never executed: end of block | 0 | ||||||||||||||||||
| 306 | else if (viewMode == QPrintPreviewWidget::FacingPagesView
| 0-1 | ||||||||||||||||||
| 307 | cols = 2; | - | ||||||||||||||||||
| 308 | numPagePlaces += 1; | - | ||||||||||||||||||
| 309 | } never executed: end of block | 0 | ||||||||||||||||||
| 310 | int rows = qCeil(qreal(numPagePlaces) / cols); | - | ||||||||||||||||||
| 311 | - | |||||||||||||||||||
| 312 | qreal itemWidth = pages.at(0)->boundingRect().width(); | - | ||||||||||||||||||
| 313 | qreal itemHeight = pages.at(0)->boundingRect().height(); | - | ||||||||||||||||||
| 314 | int pageNum = 1; | - | ||||||||||||||||||
| 315 | for (int i = 0; i < rows
| 0-4 | ||||||||||||||||||
| 316 | for (int j = 0; j < cols
| 0-4 | ||||||||||||||||||
| 317 | if (!i
| 0-3 | ||||||||||||||||||
| 318 | - | |||||||||||||||||||
| 319 | continue; never executed: continue; | 0 | ||||||||||||||||||
| 320 | } else { | - | ||||||||||||||||||
| 321 | pages.at(pageNum-1)->setPos(QPointF(j*itemWidth, i*itemHeight)); | - | ||||||||||||||||||
| 322 | pageNum++; | - | ||||||||||||||||||
| 323 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 324 | } | - | ||||||||||||||||||
| 325 | } executed 4 times by 1 test: end of blockExecuted by:
| 4 | ||||||||||||||||||
| 326 | scene->setSceneRect(scene->itemsBoundingRect()); | - | ||||||||||||||||||
| 327 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 328 | - | |||||||||||||||||||
| 329 | void QPrintPreviewWidgetPrivate::generatePreview() | - | ||||||||||||||||||
| 330 | { | - | ||||||||||||||||||
| 331 | - | |||||||||||||||||||
| 332 | - | |||||||||||||||||||
| 333 | - | |||||||||||||||||||
| 334 | - | |||||||||||||||||||
| 335 | - | |||||||||||||||||||
| 336 | - | |||||||||||||||||||
| 337 | QPrintPreviewWidget * const q = q_func(); | - | ||||||||||||||||||
| 338 | printer->d_func()->setPreviewMode(true); | - | ||||||||||||||||||
| 339 | q->paintRequested(printer); | - | ||||||||||||||||||
| 340 | printer->d_func()->setPreviewMode(false); | - | ||||||||||||||||||
| 341 | pictures = printer->d_func()->previewPages(); | - | ||||||||||||||||||
| 342 | populateScene(); | - | ||||||||||||||||||
| 343 | layoutPages(); | - | ||||||||||||||||||
| 344 | curPage = qBound(1, curPage, pages.count()); | - | ||||||||||||||||||
| 345 | if (fitting
| 0-1 | ||||||||||||||||||
| 346 | _q_fit(); executed 1 time by 1 test: _q_fit();Executed by:
| 1 | ||||||||||||||||||
| 347 | q->previewChanged(); | - | ||||||||||||||||||
| 348 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 349 | - | |||||||||||||||||||
| 350 | void QPrintPreviewWidgetPrivate::setCurrentPage(int pageNumber) | - | ||||||||||||||||||
| 351 | { | - | ||||||||||||||||||
| 352 | if (pageNumber < 1
| 0 | ||||||||||||||||||
| 353 | return; never executed: return; | 0 | ||||||||||||||||||
| 354 | - | |||||||||||||||||||
| 355 | int lastPage = curPage; | - | ||||||||||||||||||
| 356 | curPage = pageNumber; | - | ||||||||||||||||||
| 357 | - | |||||||||||||||||||
| 358 | if (lastPage != curPage
| 0 | ||||||||||||||||||
| 359 | if (zoomMode != QPrintPreviewWidget::FitInView
| 0 | ||||||||||||||||||
| 360 | QScrollBar *hsc = graphicsView->horizontalScrollBar(); | - | ||||||||||||||||||
| 361 | QScrollBar *vsc = graphicsView->verticalScrollBar(); | - | ||||||||||||||||||
| 362 | QPointF pt = graphicsView->transform().map(pages.at(curPage-1)->pos()); | - | ||||||||||||||||||
| 363 | vsc->setValue(int(pt.y()) - 10); | - | ||||||||||||||||||
| 364 | hsc->setValue(int(pt.x()) - 10); | - | ||||||||||||||||||
| 365 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 366 | graphicsView->centerOn(pages.at(curPage-1)); | - | ||||||||||||||||||
| 367 | } never executed: end of block | 0 | ||||||||||||||||||
| 368 | } | - | ||||||||||||||||||
| 369 | } never executed: end of block | 0 | ||||||||||||||||||
| 370 | - | |||||||||||||||||||
| 371 | void QPrintPreviewWidgetPrivate::zoom(qreal zoom) | - | ||||||||||||||||||
| 372 | { | - | ||||||||||||||||||
| 373 | zoomFactor *= zoom; | - | ||||||||||||||||||
| 374 | graphicsView->scale(zoom, zoom); | - | ||||||||||||||||||
| 375 | } never executed: end of block | 0 | ||||||||||||||||||
| 376 | - | |||||||||||||||||||
| 377 | void QPrintPreviewWidgetPrivate::setZoomFactor(qreal _zoomFactor) | - | ||||||||||||||||||
| 378 | { | - | ||||||||||||||||||
| 379 | QPrintPreviewWidget * const q = q_func(); | - | ||||||||||||||||||
| 380 | zoomFactor = _zoomFactor; | - | ||||||||||||||||||
| 381 | graphicsView->resetTransform(); | - | ||||||||||||||||||
| 382 | int dpi_y = q->logicalDpiY(); | - | ||||||||||||||||||
| 383 | int printer_dpi_y = printer->logicalDpiY(); | - | ||||||||||||||||||
| 384 | graphicsView->scale(zoomFactor*(dpi_y/float(printer_dpi_y)), | - | ||||||||||||||||||
| 385 | zoomFactor*(dpi_y/float(printer_dpi_y))); | - | ||||||||||||||||||
| 386 | } never executed: end of block | 0 | ||||||||||||||||||
| 387 | QPrintPreviewWidget::QPrintPreviewWidget(QPrinter *printer, QWidget *parent, Qt::WindowFlags flags) | - | ||||||||||||||||||
| 388 | : QWidget(*new QPrintPreviewWidgetPrivate, parent, flags) | - | ||||||||||||||||||
| 389 | { | - | ||||||||||||||||||
| 390 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 391 | d->printer = printer; | - | ||||||||||||||||||
| 392 | d->ownPrinter = false; | - | ||||||||||||||||||
| 393 | d->init(); | - | ||||||||||||||||||
| 394 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 395 | QPrintPreviewWidget::QPrintPreviewWidget(QWidget *parent, Qt::WindowFlags flags) | - | ||||||||||||||||||
| 396 | : QWidget(*new QPrintPreviewWidgetPrivate, parent, flags) | - | ||||||||||||||||||
| 397 | { | - | ||||||||||||||||||
| 398 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 399 | d->printer = new QPrinter; | - | ||||||||||||||||||
| 400 | d->ownPrinter = true; | - | ||||||||||||||||||
| 401 | d->init(); | - | ||||||||||||||||||
| 402 | } never executed: end of block | 0 | ||||||||||||||||||
| 403 | - | |||||||||||||||||||
| 404 | - | |||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | - | |||||||||||||||||||
| 407 | - | |||||||||||||||||||
| 408 | QPrintPreviewWidget::~QPrintPreviewWidget() | - | ||||||||||||||||||
| 409 | { | - | ||||||||||||||||||
| 410 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 411 | if (d->ownPrinter
| 0-1 | ||||||||||||||||||
| 412 | delete d->printer; never executed: delete d->printer; | 0 | ||||||||||||||||||
| 413 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 414 | - | |||||||||||||||||||
| 415 | - | |||||||||||||||||||
| 416 | - | |||||||||||||||||||
| 417 | - | |||||||||||||||||||
| 418 | QPrintPreviewWidget::ViewMode QPrintPreviewWidget::viewMode() const | - | ||||||||||||||||||
| 419 | { | - | ||||||||||||||||||
| 420 | const QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 421 | return never executed: d->viewMode;return d->viewMode;never executed: return d->viewMode; | 0 | ||||||||||||||||||
| 422 | } | - | ||||||||||||||||||
| 423 | - | |||||||||||||||||||
| 424 | - | |||||||||||||||||||
| 425 | - | |||||||||||||||||||
| 426 | - | |||||||||||||||||||
| 427 | - | |||||||||||||||||||
| 428 | void QPrintPreviewWidget::setViewMode(ViewMode mode) | - | ||||||||||||||||||
| 429 | { | - | ||||||||||||||||||
| 430 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 431 | d->viewMode = mode; | - | ||||||||||||||||||
| 432 | d->layoutPages(); | - | ||||||||||||||||||
| 433 | if (d->viewMode == AllPagesView
| 0 | ||||||||||||||||||
| 434 | d->graphicsView->fitInView(d->scene->itemsBoundingRect(), Qt::KeepAspectRatio); | - | ||||||||||||||||||
| 435 | d->fitting = false; | - | ||||||||||||||||||
| 436 | d->zoomMode = QPrintPreviewWidget::CustomZoom; | - | ||||||||||||||||||
| 437 | d->zoomFactor = d->graphicsView->transform().m11() * (float(d->printer->logicalDpiY()) / logicalDpiY()); | - | ||||||||||||||||||
| 438 | previewChanged(); | - | ||||||||||||||||||
| 439 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 440 | d->fitting = true; | - | ||||||||||||||||||
| 441 | d->_q_fit(); | - | ||||||||||||||||||
| 442 | } never executed: end of block | 0 | ||||||||||||||||||
| 443 | } | - | ||||||||||||||||||
| 444 | - | |||||||||||||||||||
| 445 | - | |||||||||||||||||||
| 446 | - | |||||||||||||||||||
| 447 | - | |||||||||||||||||||
| 448 | - | |||||||||||||||||||
| 449 | QPrinter::Orientation QPrintPreviewWidget::orientation() const | - | ||||||||||||||||||
| 450 | { | - | ||||||||||||||||||
| 451 | const QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 452 | return executed 1 time by 1 test: d->printer->orientation();return d->printer->orientation();Executed by:
executed 1 time by 1 test: return d->printer->orientation();Executed by:
| 1 | ||||||||||||||||||
| 453 | } | - | ||||||||||||||||||
| 454 | - | |||||||||||||||||||
| 455 | - | |||||||||||||||||||
| 456 | - | |||||||||||||||||||
| 457 | - | |||||||||||||||||||
| 458 | - | |||||||||||||||||||
| 459 | void QPrintPreviewWidget::setOrientation(QPrinter::Orientation orientation) | - | ||||||||||||||||||
| 460 | { | - | ||||||||||||||||||
| 461 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 462 | d->printer->setOrientation(orientation); | - | ||||||||||||||||||
| 463 | d->generatePreview(); | - | ||||||||||||||||||
| 464 | } never executed: end of block | 0 | ||||||||||||||||||
| 465 | - | |||||||||||||||||||
| 466 | - | |||||||||||||||||||
| 467 | - | |||||||||||||||||||
| 468 | - | |||||||||||||||||||
| 469 | void QPrintPreviewWidget::print() | - | ||||||||||||||||||
| 470 | { | - | ||||||||||||||||||
| 471 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 472 | - | |||||||||||||||||||
| 473 | paintRequested(d->printer); | - | ||||||||||||||||||
| 474 | } never executed: end of block | 0 | ||||||||||||||||||
| 475 | - | |||||||||||||||||||
| 476 | - | |||||||||||||||||||
| 477 | - | |||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | - | |||||||||||||||||||
| 480 | void QPrintPreviewWidget::zoomIn(qreal factor) | - | ||||||||||||||||||
| 481 | { | - | ||||||||||||||||||
| 482 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 483 | d->fitting = false; | - | ||||||||||||||||||
| 484 | d->zoomMode = QPrintPreviewWidget::CustomZoom; | - | ||||||||||||||||||
| 485 | d->zoom(factor); | - | ||||||||||||||||||
| 486 | } never executed: end of block | 0 | ||||||||||||||||||
| 487 | - | |||||||||||||||||||
| 488 | - | |||||||||||||||||||
| 489 | - | |||||||||||||||||||
| 490 | - | |||||||||||||||||||
| 491 | - | |||||||||||||||||||
| 492 | void QPrintPreviewWidget::zoomOut(qreal factor) | - | ||||||||||||||||||
| 493 | { | - | ||||||||||||||||||
| 494 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 495 | d->fitting = false; | - | ||||||||||||||||||
| 496 | d->zoomMode = QPrintPreviewWidget::CustomZoom; | - | ||||||||||||||||||
| 497 | d->zoom(1/factor); | - | ||||||||||||||||||
| 498 | } never executed: end of block | 0 | ||||||||||||||||||
| 499 | - | |||||||||||||||||||
| 500 | - | |||||||||||||||||||
| 501 | - | |||||||||||||||||||
| 502 | - | |||||||||||||||||||
| 503 | qreal QPrintPreviewWidget::zoomFactor() const | - | ||||||||||||||||||
| 504 | { | - | ||||||||||||||||||
| 505 | const QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 506 | return executed 13 times by 1 test: d->zoomFactor;return d->zoomFactor;Executed by:
executed 13 times by 1 test: return d->zoomFactor;Executed by:
| 13 | ||||||||||||||||||
| 507 | } | - | ||||||||||||||||||
| 508 | void QPrintPreviewWidget::setZoomFactor(qreal factor) | - | ||||||||||||||||||
| 509 | { | - | ||||||||||||||||||
| 510 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 511 | d->fitting = false; | - | ||||||||||||||||||
| 512 | d->zoomMode = QPrintPreviewWidget::CustomZoom; | - | ||||||||||||||||||
| 513 | d->setZoomFactor(factor); | - | ||||||||||||||||||
| 514 | } never executed: end of block | 0 | ||||||||||||||||||
| 515 | - | |||||||||||||||||||
| 516 | - | |||||||||||||||||||
| 517 | - | |||||||||||||||||||
| 518 | - | |||||||||||||||||||
| 519 | - | |||||||||||||||||||
| 520 | int QPrintPreviewWidget::pageCount() const | - | ||||||||||||||||||
| 521 | { | - | ||||||||||||||||||
| 522 | const QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 523 | return executed 26 times by 1 test: d->pages.size();return d->pages.size();Executed by:
executed 26 times by 1 test: return d->pages.size();Executed by:
| 26 | ||||||||||||||||||
| 524 | } | - | ||||||||||||||||||
| 525 | - | |||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | - | |||||||||||||||||||
| 528 | - | |||||||||||||||||||
| 529 | int QPrintPreviewWidget::currentPage() const | - | ||||||||||||||||||
| 530 | { | - | ||||||||||||||||||
| 531 | const QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 532 | return executed 14 times by 1 test: d->curPage;return d->curPage;Executed by:
executed 14 times by 1 test: return d->curPage;Executed by:
| 14 | ||||||||||||||||||
| 533 | } | - | ||||||||||||||||||
| 534 | - | |||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | - | |||||||||||||||||||
| 537 | - | |||||||||||||||||||
| 538 | - | |||||||||||||||||||
| 539 | void QPrintPreviewWidget::setCurrentPage(int page) | - | ||||||||||||||||||
| 540 | { | - | ||||||||||||||||||
| 541 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 542 | d->setCurrentPage(page); | - | ||||||||||||||||||
| 543 | } never executed: end of block | 0 | ||||||||||||||||||
| 544 | - | |||||||||||||||||||
| 545 | - | |||||||||||||||||||
| 546 | - | |||||||||||||||||||
| 547 | - | |||||||||||||||||||
| 548 | - | |||||||||||||||||||
| 549 | void QPrintPreviewWidget::fitToWidth() | - | ||||||||||||||||||
| 550 | { | - | ||||||||||||||||||
| 551 | setZoomMode(FitToWidth); | - | ||||||||||||||||||
| 552 | } never executed: end of block | 0 | ||||||||||||||||||
| 553 | - | |||||||||||||||||||
| 554 | - | |||||||||||||||||||
| 555 | - | |||||||||||||||||||
| 556 | - | |||||||||||||||||||
| 557 | - | |||||||||||||||||||
| 558 | void QPrintPreviewWidget::fitInView() | - | ||||||||||||||||||
| 559 | { | - | ||||||||||||||||||
| 560 | setZoomMode(FitInView); | - | ||||||||||||||||||
| 561 | } never executed: end of block | 0 | ||||||||||||||||||
| 562 | - | |||||||||||||||||||
| 563 | - | |||||||||||||||||||
| 564 | - | |||||||||||||||||||
| 565 | - | |||||||||||||||||||
| 566 | - | |||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | void QPrintPreviewWidget::setZoomMode(QPrintPreviewWidget::ZoomMode zoomMode) | - | ||||||||||||||||||
| 569 | { | - | ||||||||||||||||||
| 570 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 571 | d->zoomMode = zoomMode; | - | ||||||||||||||||||
| 572 | if (d->zoomMode == FitInView
| 0 | ||||||||||||||||||
| 573 | d->fitting = true; | - | ||||||||||||||||||
| 574 | d->_q_fit(true); | - | ||||||||||||||||||
| 575 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 576 | d->fitting = false; | - | ||||||||||||||||||
| 577 | } never executed: end of block | 0 | ||||||||||||||||||
| 578 | } | - | ||||||||||||||||||
| 579 | - | |||||||||||||||||||
| 580 | - | |||||||||||||||||||
| 581 | - | |||||||||||||||||||
| 582 | - | |||||||||||||||||||
| 583 | - | |||||||||||||||||||
| 584 | - | |||||||||||||||||||
| 585 | QPrintPreviewWidget::ZoomMode QPrintPreviewWidget::zoomMode() const | - | ||||||||||||||||||
| 586 | { | - | ||||||||||||||||||
| 587 | const QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 588 | return never executed: d->zoomMode;return d->zoomMode;never executed: return d->zoomMode; | 0 | ||||||||||||||||||
| 589 | } | - | ||||||||||||||||||
| 590 | - | |||||||||||||||||||
| 591 | - | |||||||||||||||||||
| 592 | - | |||||||||||||||||||
| 593 | - | |||||||||||||||||||
| 594 | - | |||||||||||||||||||
| 595 | void QPrintPreviewWidget::setLandscapeOrientation() | - | ||||||||||||||||||
| 596 | { | - | ||||||||||||||||||
| 597 | setOrientation(QPrinter::Landscape); | - | ||||||||||||||||||
| 598 | } never executed: end of block | 0 | ||||||||||||||||||
| 599 | - | |||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | - | |||||||||||||||||||
| 602 | - | |||||||||||||||||||
| 603 | - | |||||||||||||||||||
| 604 | void QPrintPreviewWidget::setPortraitOrientation() | - | ||||||||||||||||||
| 605 | { | - | ||||||||||||||||||
| 606 | setOrientation(QPrinter::Portrait); | - | ||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||
| 608 | - | |||||||||||||||||||
| 609 | - | |||||||||||||||||||
| 610 | - | |||||||||||||||||||
| 611 | - | |||||||||||||||||||
| 612 | - | |||||||||||||||||||
| 613 | void QPrintPreviewWidget::setSinglePageViewMode() | - | ||||||||||||||||||
| 614 | { | - | ||||||||||||||||||
| 615 | setViewMode(SinglePageView); | - | ||||||||||||||||||
| 616 | } never executed: end of block | 0 | ||||||||||||||||||
| 617 | - | |||||||||||||||||||
| 618 | - | |||||||||||||||||||
| 619 | - | |||||||||||||||||||
| 620 | - | |||||||||||||||||||
| 621 | - | |||||||||||||||||||
| 622 | void QPrintPreviewWidget::setFacingPagesViewMode() | - | ||||||||||||||||||
| 623 | { | - | ||||||||||||||||||
| 624 | setViewMode(FacingPagesView); | - | ||||||||||||||||||
| 625 | } never executed: end of block | 0 | ||||||||||||||||||
| 626 | - | |||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | - | |||||||||||||||||||
| 629 | - | |||||||||||||||||||
| 630 | - | |||||||||||||||||||
| 631 | void QPrintPreviewWidget::setAllPagesViewMode() | - | ||||||||||||||||||
| 632 | { | - | ||||||||||||||||||
| 633 | setViewMode(AllPagesView); | - | ||||||||||||||||||
| 634 | } never executed: end of block | 0 | ||||||||||||||||||
| 635 | - | |||||||||||||||||||
| 636 | - | |||||||||||||||||||
| 637 | - | |||||||||||||||||||
| 638 | - | |||||||||||||||||||
| 639 | - | |||||||||||||||||||
| 640 | - | |||||||||||||||||||
| 641 | void QPrintPreviewWidget::updatePreview() | - | ||||||||||||||||||
| 642 | { | - | ||||||||||||||||||
| 643 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 644 | d->initialized = true; | - | ||||||||||||||||||
| 645 | d->generatePreview(); | - | ||||||||||||||||||
| 646 | d->graphicsView->updateGeometry(); | - | ||||||||||||||||||
| 647 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 648 | - | |||||||||||||||||||
| 649 | - | |||||||||||||||||||
| 650 | - | |||||||||||||||||||
| 651 | void QPrintPreviewWidget::setVisible(bool visible) | - | ||||||||||||||||||
| 652 | { | - | ||||||||||||||||||
| 653 | QPrintPreviewWidgetPrivate * const d = d_func(); | - | ||||||||||||||||||
| 654 | if (visible
| 0-1 | ||||||||||||||||||
| 655 | updatePreview(); never executed: updatePreview(); | 0 | ||||||||||||||||||
| 656 | QWidget::setVisible(visible); | - | ||||||||||||||||||
| 657 | } executed 1 time by 1 test: end of blockExecuted by:
| 1 | ||||||||||||||||||
| 658 | - | |||||||||||||||||||
| 659 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |