QPdfSearchModel#

The QPdfSearchModel class searches for a string in a PDF document and holds the results. More

Inheritance diagram of PySide6.QtPdf.QPdfSearchModel

Synopsis#

Functions#

Slots#

Signals#

Detailed Description#

This is used in the Model/View Programming paradigm to display a list of search results, to highlight them on the rendered PDF pages, and to iterate through them using the “search forward” / “search backward” buttons and shortcuts that would be found in a typical document-viewing UI:

../../_images/search-results.png
class PySide6.QtPdf.QPdfSearchModel#

PySide6.QtPdf.QPdfSearchModel(parent)

Parameters

parentPySide6.QtCore.QObject

Constructs a new search model with parent object parent.

PySide6.QtPdf.QPdfSearchModel.Role#

Constant

Description

QPdfSearchModel.Role.Page

The page number where the search result is found (int).

QPdfSearchModel.Role.IndexOnPage

The index of the search result on the page (int).

QPdfSearchModel.Role.Location

The position of the search result on the page ( QPointF ).

QPdfSearchModel.Role.ContextBefore

The adjacent text on the page, before the search string ( QString ).

QPdfSearchModel.Role.ContextAfter

The adjacent text on the page, after the search string ( QString ).

See also

QPdfLink

PySide6.QtPdf.QPdfSearchModel.document()#
Return type

PySide6.QtPdf.QPdfDocument

This property holds the document to search.

PySide6.QtPdf.QPdfSearchModel.documentChanged()#
PySide6.QtPdf.QPdfSearchModel.resultAtIndex(index)#
Parameters

index – int

Return type

PySide6.QtPdf.QPdfLink

Returns a result found by index in the document , regardless of the page on which it was found. index must be less than rowCount .

PySide6.QtPdf.QPdfSearchModel.resultsOnPage(page)#
Parameters

page – int

Return type

Returns the list of all results found on the given page.

PySide6.QtPdf.QPdfSearchModel.searchString()#
Return type

str

This property holds the string to search for.

PySide6.QtPdf.QPdfSearchModel.searchStringChanged()#
PySide6.QtPdf.QPdfSearchModel.setDocument(document)#
Parameters

documentPySide6.QtPdf.QPdfDocument

This property holds the document to search.

PySide6.QtPdf.QPdfSearchModel.setSearchString(searchString)#
Parameters

searchString – str

This property holds the string to search for.

PySide6.QtPdf.QPdfSearchModel.updatePage(page)#
Parameters

page – int