A PDF viewer widget. 更多...
| 頭: |
#include <QPdfView>
|
| 繼承: | QAbstractScrollArea |
| 枚舉類 | PageMode { SinglePage, MultiPage } |
| 枚舉類 | ZoomMode { Custom, FitToWidth, FitInView } |
|
|
| QPdfView (QWidget * parent ) | |
| virtual | ~QPdfView () |
| int | currentSearchResultIndex () const |
| QPdfDocument * | document () const |
| QMargins | documentMargins () const |
| QPdfView::PageMode | pageMode () const |
| QPdfPageNavigator * | pageNavigator () const |
| int | pageSpacing () const |
| QPdfSearchModel * | searchModel () const |
| void | setDocument (QPdfDocument * document ) |
| void | setDocumentMargins (QMargins margins ) |
| void | setPageSpacing (int spacing ) |
| void | setSearchModel (QPdfSearchModel * searchModel ) |
| qreal | zoomFactor () const |
| QPdfView::ZoomMode | zoomMode () const |
| void | setCurrentSearchResultIndex (int currentResult ) |
| void | setPageMode (QPdfView::PageMode mode ) |
| void | setZoomFactor (qreal factor ) |
| void | setZoomMode (QPdfView::ZoomMode mode ) |
| void | currentSearchResultIndexChanged (int currentResult ) |
| void | documentChanged (QPdfDocument * document ) |
| void | documentMarginsChanged (QMargins documentMargins ) |
| void | pageModeChanged (QPdfView::PageMode pageMode ) |
| void | pageSpacingChanged (int pageSpacing ) |
| void | searchModelChanged (QPdfSearchModel * searchModel ) |
| 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
。在
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.
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. |
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. |
[since 6.6]
currentSearchResultIndex
:
int
If this property is set to a positive number, and searchModel 有設置, QPdfView draws a frame around the search result provided by QPdfSearchModel at the given index. For example, if QPdfSearchModel is used as the model for a QListView , you can keep this property updated by connecting QItemSelectionModel::currentChanged () 從 QListView::selectionModel () to a function that will in turn call this function.
By default it is
-1
, so that no search results are framed.
該特性在 Qt 6.6 引入。
訪問函數:
| int | currentSearchResultIndex () const |
| void | setCurrentSearchResultIndex (int currentResult ) |
通知程序信號:
| void | currentSearchResultIndexChanged (int currentResult ) |
This property holds the document to be viewed.
訪問函數:
| QPdfDocument * | document () const |
| void | setDocument (QPdfDocument * document ) |
通知程序信號:
| void | documentChanged (QPdfDocument * document ) |
This property holds the margins around the page view.
訪問函數:
| QMargins | documentMargins () const |
| void | setDocumentMargins (QMargins margins ) |
通知程序信號:
| void | documentMarginsChanged (QMargins documentMargins ) |
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 ) |
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 ) |
[since 6.6]
searchModel
:
QPdfSearchModel
*
If this property is set,
QPdfView
draws highlight rectangles over the search results provided by
QPdfSearchModel::resultsOnPage
(). By default it is
nullptr
.
該特性在 Qt 6.6 引入。
訪問函數:
| QPdfSearchModel * | searchModel () const |
| void | setSearchModel (QPdfSearchModel * searchModel ) |
通知程序信號:
| void | searchModelChanged (QPdfSearchModel * searchModel ) |
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 ) |
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 .
[virtual noexcept]
QPdfView::
~QPdfView
()
銷毀 PDF 查看器。
This accessor returns the navigation stack that will handle back/forward navigation.