diff options
-rw-r--r-- | src/gui/dialogs/qprintpreviewdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/widgets/qprintpreviewwidget.cpp | 12 | ||||
-rw-r--r-- | src/gui/widgets/qprintpreviewwidget.h | 3 |
3 files changed, 17 insertions, 4 deletions
diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index 4cb0c93..1f0b51d 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -446,7 +446,7 @@ void QPrintPreviewDialogPrivate::setFitting(bool on) void QPrintPreviewDialogPrivate::updateNavActions() { int curPage = preview->currentPage(); - int numPages = preview->numPages(); + int numPages = preview->pageCount(); nextPageAction->setEnabled(curPage < numPages); prevPageAction->setEnabled(curPage > 1); firstPageAction->setEnabled(curPage > 1); @@ -458,7 +458,7 @@ void QPrintPreviewDialogPrivate::updatePageNumLabel() { Q_Q(QPrintPreviewDialog); - int numPages = preview->numPages(); + int numPages = preview->pageCount(); int maxChars = QString::number(numPages).length(); pageNumLabel->setText(QString::fromLatin1("/ %1").arg(numPages)); int cyphersWidth = q->fontMetrics().width(QString().fill(QLatin1Char('8'), maxChars)); @@ -515,7 +515,7 @@ void QPrintPreviewDialogPrivate::_q_navigate(QAction* action) else if (action == firstPageAction) preview->setCurrentPage(1); else if (action == lastPageAction) - preview->setCurrentPage(preview->numPages()); + preview->setCurrentPage(preview->pageCount()); updateNavActions(); } diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp index d92b1ea..0074c91 100644 --- a/src/gui/widgets/qprintpreviewwidget.cpp +++ b/src/gui/widgets/qprintpreviewwidget.cpp @@ -663,7 +663,9 @@ void QPrintPreviewWidget::setZoomFactor(qreal factor) } /*! + \obsolete Returns the number of pages in the preview. + \sa pageCount() */ int QPrintPreviewWidget::numPages() const { @@ -672,6 +674,16 @@ int QPrintPreviewWidget::numPages() const } /*! + \since 4.6 + Returns the number of pages in the preview. +*/ +int QPrintPreviewWidget::pageCount() const +{ + Q_D(const QPrintPreviewWidget); + return d->pages.size(); +} + +/*! Returns the currently viewed page in the preview. */ int QPrintPreviewWidget::currentPage() const diff --git a/src/gui/widgets/qprintpreviewwidget.h b/src/gui/widgets/qprintpreviewwidget.h index 2823873..08e596d 100644 --- a/src/gui/widgets/qprintpreviewwidget.h +++ b/src/gui/widgets/qprintpreviewwidget.h @@ -82,7 +82,8 @@ public: ViewMode viewMode() const; ZoomMode zoomMode() const; int currentPage() const; - int numPages() const; + QT_DEPRECATED int numPages() const; + int pageCount() const; void setVisible(bool visible); public Q_SLOTS: |