![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtPdf More...
#include <qpdfview.h>
Public Types | |
enum class | PageMode { SinglePage , MultiPage } |
This enum describes the overall behavior of the PDF viewer: More... | |
enum class | ZoomMode { Custom , FitToWidth , FitInView } |
This enum describes the magnification behavior of the PDF viewer: More... | |
Public Slots | |
void | setPageMode (QPdfView::PageMode mode) |
void | setZoomMode (QPdfView::ZoomMode mode) |
void | setZoomFactor (qreal factor) |
void | setCurrentSearchResult (int currentResult) |
Public Member Functions | |
QPdfView () | |
QPdfView (QWidget *parent) | |
Constructs a PDF viewer with parent widget parent. | |
~QPdfView () | |
Destroys the PDF viewer. | |
void | setDocument (QPdfDocument *document) |
QPdfDocument * | document () const |
QPdfSearchModel * | searchModel () const |
void | setSearchModel (QPdfSearchModel *searchModel) |
int | currentSearchResult () const |
QPdfPageNavigator * | pageNavigator () const |
This accessor returns the navigation stack that will handle back/forward navigation. | |
PageMode | pageMode () const |
ZoomMode | zoomMode () const |
qreal | zoomFactor () const |
int | pageSpacing () const |
void | setPageSpacing (int spacing) |
QMargins | documentMargins () const |
void | setDocumentMargins (QMargins margins) |
Protected Member Functions | |
void | paintEvent (QPaintEvent *event) override |
void | resizeEvent (QResizeEvent *event) override |
void | scrollContentsBy (int dx, int dy) override |
void | mousePressEvent (QMouseEvent *event) override |
void | mouseMoveEvent (QMouseEvent *event) override |
void | mouseReleaseEvent (QMouseEvent *event) override |
Properties | |
QPdfDocument * | document |
This property holds the document to be viewed. | |
PageMode | pageMode |
This property holds whether to show one page at a time, or all pages in the document. | |
ZoomMode | zoomMode |
This property indicates whether to use a custom size for the page(s), or zoom them to fit to the view. | |
qreal | zoomFactor |
This property holds the ratio of pixels to points. | |
int | pageSpacing |
This property holds the size of the padding between pages in the \l MultiPage \l {pageMode}{mode}. | |
QMargins | documentMargins |
This property holds the margins around the page view. | |
QPdfSearchModel * | searchModel |
int | currentSearchResult |
\inmodule QtPdf
A PDF viewer widget.
QPdfView is a PDF viewer widget that offers a user experience similar to many common PDF viewer applications, with two \l {pageMode}{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.
Definition at line 20 of file qpdfview.h.
|
strong |
This enum describes the overall behavior of the PDF viewer:
\value SinglePage Show one page at a time. \value MultiPage Allow scrolling through all pages in the document.
Enumerator | |
---|---|
SinglePage | |
MultiPage |
Definition at line 37 of file qpdfview.h.
|
strong |
This enum describes the magnification behavior of the PDF viewer:
\value Custom Use \l zoomFactor only. \value FitToWidth Automatically choose a zoom factor so that the width of the page fits in the view. \value FitInView Automatically choose a zoom factor so that the entire page fits in the view.
Enumerator | |
---|---|
Custom | |
FitToWidth | |
FitInView |
Definition at line 44 of file qpdfview.h.
|
inline |
Definition at line 52 of file qpdfview.h.
|
explicit |
Constructs a PDF viewer with parent widget parent.
Definition at line 280 of file qpdfview.cpp.
QPdfView::~QPdfView | ( | ) |
Destroys the PDF viewer.
Definition at line 305 of file qpdfview.cpp.
int QPdfView::currentSearchResult | ( | ) | const |
Definition at line 402 of file qpdfview.cpp.
|
signal |
QPdfDocument * QPdfView::document | ( | ) | const |
Definition at line 338 of file qpdfview.cpp.
|
signal |
QMargins QPdfView::documentMargins | ( | ) | const |
Definition at line 548 of file qpdfview.cpp.
|
overrideprotected |
Definition at line 656 of file qpdfview.cpp.
|
overrideprotected |
Definition at line 651 of file qpdfview.cpp.
|
overrideprotected |
Definition at line 674 of file qpdfview.cpp.
QPdfView::PageMode QPdfView::pageMode | ( | ) | const |
Definition at line 433 of file qpdfview.cpp.
|
signal |
QPdfPageNavigator * QPdfView::pageNavigator | ( | ) | const |
This accessor returns the navigation stack that will handle back/forward navigation.
Definition at line 411 of file qpdfview.cpp.
int QPdfView::pageSpacing | ( | ) | const |
Definition at line 523 of file qpdfview.cpp.
|
signal |
|
overrideprotected |
Definition at line 568 of file qpdfview.cpp.
|
overrideprotected |
Definition at line 632 of file qpdfview.cpp.
|
overrideprotected |
Definition at line 642 of file qpdfview.cpp.
QPdfSearchModel * QPdfView::searchModel | ( | ) | const |
Definition at line 372 of file qpdfview.cpp.
|
signal |
|
slot |
Definition at line 391 of file qpdfview.cpp.
void QPdfView::setDocument | ( | QPdfDocument * | document | ) |
Definition at line 314 of file qpdfview.cpp.
Definition at line 555 of file qpdfview.cpp.
|
slot |
Definition at line 440 of file qpdfview.cpp.
void QPdfView::setPageSpacing | ( | int | spacing | ) |
Definition at line 530 of file qpdfview.cpp.
void QPdfView::setSearchModel | ( | QPdfSearchModel * | searchModel | ) |
Definition at line 353 of file qpdfview.cpp.
Definition at line 504 of file qpdfview.cpp.
|
slot |
Definition at line 478 of file qpdfview.cpp.
qreal QPdfView::zoomFactor | ( | ) | const |
Definition at line 497 of file qpdfview.cpp.
QPdfView::ZoomMode QPdfView::zoomMode | ( | ) | const |
Definition at line 471 of file qpdfview.cpp.
|
signal |
|
readwrite |
If this property is set to a positive number, and \l searchModel is set, QPdfView draws a frame around the search result provided by \l 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() from QListView::selectionModel() to a function that will in turn call this function.
By default it is -1
, so that no search results are framed.
Definition at line 105 of file qpdfview.h.
|
readwrite |
This property holds the document to be viewed.
Definition at line 105 of file qpdfview.h.
|
readwrite |
This property holds the margins around the page view.
Definition at line 105 of file qpdfview.h.
|
readwrite |
This property holds whether to show one page at a time, or all pages in the document.
The default is SinglePage
.
Definition at line 105 of file qpdfview.h.
|
readwrite |
This property holds the size of the padding between pages in the \l MultiPage \l {pageMode}{mode}.
Definition at line 105 of file qpdfview.h.
|
readwrite |
If this property is set, QPdfView draws highlight rectangles over the search results provided by \l QPdfSearchModel::resultsOnPage(). By default it is nullptr
.
Definition at line 105 of file qpdfview.h.
|
readwrite |
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.
Definition at line 105 of file qpdfview.h.
|
readwrite |
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
.
Definition at line 105 of file qpdfview.h.