QPdfView 类

A PDF viewer widget. 更多...

头: #include <QPdfView>
继承: QAbstractScrollArea

公共类型

enum class PageMode { SinglePage, MultiPage }
enum class ZoomMode { Custom, FitToWidth, FitInView }

特性

公共函数

QPdfView (QWidget * parent )
virtual ~QPdfView ()
QPdfDocument * document () const
QMargins documentMargins () const
QPdfView::PageMode pageMode () const
QPdfPageNavigator * pageNavigator () const
int pageSpacing () const
void setDocument (QPdfDocument * document )
void setDocumentMargins (QMargins margins )
void setPageSpacing (int spacing )
qreal zoomFactor () const
QPdfView::ZoomMode zoomMode () const

公共槽

void setPageMode (QPdfView::PageMode mode )
void setZoomFactor (qreal factor )
void setZoomMode (QPdfView::ZoomMode mode )

信号

void documentChanged (QPdfDocument * document )
void documentMarginsChanged (QMargins documentMargins )
void pageModeChanged (QPdfView::PageMode pageMode )
void pageSpacingChanged (int pageSpacing )
void zoomFactorChanged (qreal zoomFactor )
void zoomModeChanged (QPdfView::ZoomMode zoomMode )

详细描述

QPdfView is a PDF viewer widget that offers a user experience similar to many common PDF viewer applications, with two modes . In the MultiPage mode, it supports flicking through the pages in the entire document, with narrow gaps between the page images. In the SinglePage mode, it shows one page at a time.

成员类型文档编制

enum class QPdfView:: PageMode

This enum describes the overall behavior of the PDF viewer:

常量 描述
QPdfView::PageMode::SinglePage 0 Show one page at a time.
QPdfView::PageMode::MultiPage 1 Allow scrolling through all pages in the document.

enum class QPdfView:: ZoomMode

This enum describes the magnification behavior of the PDF viewer:

常量 描述
QPdfView::ZoomMode::Custom 0 使用 zoomFactor 仅。
QPdfView::ZoomMode::FitToWidth 1 Automatically choose a zoom factor so that the width of the page fits in the view.
QPdfView::ZoomMode::FitInView 2 Automatically choose a zoom factor so that the entire page fits in the view.

特性文档编制

document : QPdfDocument *

This property holds the document to be viewed.

访问函数:

QPdfDocument * document () const
void setDocument (QPdfDocument * document )

通知程序信号:

void documentChanged (QPdfDocument * document )

documentMargins : QMargins

This property holds the margins around the page view.

访问函数:

QMargins documentMargins () const
void setDocumentMargins (QMargins margins )

通知程序信号:

void documentMarginsChanged (QMargins documentMargins )

pageMode : PageMode

This property holds whether to show one page at a time, or all pages in the document. The default is SinglePage .

访问函数:

QPdfView::PageMode pageMode () const
void setPageMode (QPdfView::PageMode mode )

通知程序信号:

void pageModeChanged (QPdfView::PageMode pageMode )

pageSpacing : int

This property holds the size of the padding between pages in the MultiPage mode .

访问函数:

int pageSpacing () const
void setPageSpacing (int spacing )

通知程序信号:

void pageSpacingChanged (int pageSpacing )

zoomFactor : qreal

This property holds the ratio of pixels to points. The default is 1 , meaning one point (1/72 of an inch) equals 1 logical pixel.

访问函数:

qreal zoomFactor () const
void setZoomFactor (qreal factor )

通知程序信号:

void zoomFactorChanged (qreal zoomFactor )

zoomMode : ZoomMode

This property indicates whether to use a custom size for the page(s), or zoom them to fit to the view. The default is CustomZoom .

访问函数:

QPdfView::ZoomMode zoomMode () const
void setZoomMode (QPdfView::ZoomMode mode )

通知程序信号:

void zoomModeChanged (QPdfView::ZoomMode zoomMode )

成员函数文档编制

[explicit] QPdfView:: QPdfView ( QWidget * parent )

构造 PDF 查看器采用父级小部件 parent .

[虚拟] QPdfView:: ~QPdfView ()

销毁 PDF 查看器。

This accessor returns the navigation stack that will handle back/forward navigation.