Changeset 561 for trunk/src/gui/widgets/qprintpreviewwidget.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/gui/widgets/qprintpreviewwidget.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtGui module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 41 41 42 42 #include "qprintpreviewwidget.h" 43 #include "private/qwidget_p.h" 43 44 #include <private/qprinter_p.h> 44 45 … … 99 100 QRectF paperRect(0,0, paperSize.width(), paperSize.height()); 100 101 101 painter->setClipRect(paperRect & option->exposedRect); 102 painter->fillRect(paperRect, Qt::white); 103 if (!pagePicture) 104 return; 105 painter->drawPicture(pageRect.topLeft(), *pagePicture); 106 107 // Effect: make anything drawn in the margins look washed out. 108 QPainterPath path; 109 path.addRect(paperRect); 110 path.addRect(pageRect); 111 painter->setPen(QPen(Qt::NoPen)); 112 painter->setBrush(QColor(255, 255, 255, 180)); 113 painter->drawPath(path); 114 102 // Draw shadow 115 103 painter->setClipRect(option->exposedRect); 116 #if 0117 // Draw frame around paper.118 painter->setPen(QPen(Qt::black, 0));119 painter->setBrush(Qt::NoBrush);120 painter->drawRect(paperRect);121 #endif122 123 // Draw shadow124 104 qreal shWidth = paperRect.width()/100; 125 105 QRectF rshadow(paperRect.topRight() + QPointF(0, shWidth), … … 142 122 painter->fillRect(cshadow, QBrush(cgrad)); 143 123 124 painter->setClipRect(paperRect & option->exposedRect); 125 painter->fillRect(paperRect, Qt::white); 126 if (!pagePicture) 127 return; 128 painter->drawPicture(pageRect.topLeft(), *pagePicture); 129 130 // Effect: make anything drawn in the margins look washed out. 131 QPainterPath path; 132 path.addRect(paperRect); 133 path.addRect(pageRect); 134 painter->setPen(QPen(Qt::NoPen)); 135 painter->setBrush(QColor(255, 255, 255, 180)); 136 painter->drawPath(path); 137 138 #if 0 139 // Draw frame around paper. 140 painter->setPen(QPen(Qt::black, 0)); 141 painter->setBrush(Qt::NoBrush); 142 painter->drawRect(paperRect); 143 #endif 144 144 145 // todo: drawtext "Page N" below paper 145 146 } … … 171 172 } // anonymous namespace 172 173 173 class QPrintPreviewWidgetPrivate 174 class QPrintPreviewWidgetPrivate : public QWidgetPrivate 174 175 { 175 176 Q_DECLARE_PUBLIC(QPrintPreviewWidget) 176 177 public: 177 QPrintPreviewWidgetPrivate( QPrintPreviewWidget *q)178 : q_ptr(q),scene(0), curPage(1),178 QPrintPreviewWidgetPrivate() 179 : scene(0), curPage(1), 179 180 viewMode(QPrintPreviewWidget::SinglePageView), 180 181 zoomMode(QPrintPreviewWidget::FitInView), … … 195 196 int calcCurrentPage(); 196 197 197 QPrintPreviewWidget *q_ptr;198 198 GraphicsView *graphicsView; 199 199 QGraphicsScene *scene; … … 453 453 previewing page layouts for printer output. 454 454 455 \ingroup multimedia455 \ingroup printing 456 456 457 457 QPrintPreviewDialog uses a QPrintPreviewWidget internally, and the … … 519 519 */ 520 520 QPrintPreviewWidget::QPrintPreviewWidget(QPrinter *printer, QWidget *parent, Qt::WindowFlags flags) 521 : QWidget( parent, flags), d_ptr(new QPrintPreviewWidgetPrivate(this))521 : QWidget(*new QPrintPreviewWidgetPrivate, parent, flags) 522 522 { 523 523 Q_D(QPrintPreviewWidget); … … 535 535 */ 536 536 QPrintPreviewWidget::QPrintPreviewWidget(QWidget *parent, Qt::WindowFlags flags) 537 : QWidget( parent, flags), d_ptr(new QPrintPreviewWidgetPrivate(this))537 : QWidget(*new QPrintPreviewWidgetPrivate, parent, flags) 538 538 { 539 539 Q_D(QPrintPreviewWidget); … … 552 552 if (d->ownPrinter) 553 553 delete d->printer; 554 delete d_ptr;555 554 } 556 555 … … 665 664 666 665 /*! 666 \obsolete 667 667 Returns the number of pages in the preview. 668 \sa pageCount() 668 669 */ 669 670 int QPrintPreviewWidget::numPages() const 671 { 672 Q_D(const QPrintPreviewWidget); 673 return d->pages.size(); 674 } 675 676 /*! 677 \since 4.6 678 Returns the number of pages in the preview. 679 */ 680 int QPrintPreviewWidget::pageCount() const 670 681 { 671 682 Q_D(const QPrintPreviewWidget);
Note:
See TracChangeset
for help on using the changeset viewer.