# eric7.PdfViewer.PdfSearchWidget

Module implementing a Search widget.

### Global Attributes

None

### Classes

PdfSearchResultsWidget | Class implementing a widget to show the search results.
PdfSearchWidget | Class implementing a Search widget.

### Functions

None

## PdfSearchResultsWidget

Class implementing a widget to show the search results.

### Signals

rowCountChanged()
  emitted to indicate a change of the number of items
searchCleared()
  emitted to indicate that the search results have been cleared
searchNextAvailable(bool)
  emitted to indicate the availability of search results after the current one
searchPrevAvailable(bool)
  emitted to indicate the availability of search results before the current one
searchResult(QPdfLink)
  emitted to send the link of a search result

### Derived from

QTreeWidget

### Class Attributes

None

### Class Methods

None

### Methods

PdfSearchResultsWidget | Constructor
__clear | Private slot to clear the list of search results.
__handleCurrentItemChanged | Private slot to handle a change of the current item.
__rowsInserted | Private slot to handle the insertion of rows of the search model.
currentRow | Public method to get the current row.
document | Public method to get the reference to the PDF document object.
getPdfLink | Public method to get the PDF link associated with a search result item.
rowCount | Public method to get the number of rows.
searchResultData | Public method to get data of a search result item.
searchString | Public method to get the current search string.
setCurrentRow | Public method to set the current row.
setDocument | Public method to set the PDF document object to be searched.
setSearchString | Public method to set the search string.

### Static Methods

None

#### PdfSearchResultsWidget (Constructor)

PdfSearchResultsWidget(parent=None)

Constructor

parent (QWidget (optional))
  reference to the parent widget (defaults to None)

#### PdfSearchResultsWidget.__clear

__clear()

Private slot to clear the list of search results.

#### PdfSearchResultsWidget.__handleCurrentItemChanged

__handleCurrentItemChanged()

Private slot to handle a change of the current item.

#### PdfSearchResultsWidget.__rowsInserted

__rowsInserted(parent, first, last)

Private slot to handle the insertion of rows of the search model.

parent (QModelIndex)
  reference to the parent index
first (int)
  first row inserted
last (int)
  last row inserted

#### PdfSearchResultsWidget.currentRow

currentRow()

Public method to get the current row.

Return:
  current row

Return Type:
  int

#### PdfSearchResultsWidget.document

document()

Public method to get the reference to the PDF document object.

Return:
  reference to the PDF document object

Return Type:
  QPdfDocument

#### PdfSearchResultsWidget.getPdfLink

getPdfLink(item)

Public method to get the PDF link associated with a search result item.

item (QTreeWidgetItem)
  reference to the search result item

Return:
  associated PDF link

Return Type:
  QPdfLink

#### PdfSearchResultsWidget.rowCount

rowCount()

Public method to get the number of rows.

Return:
  number of rows

Return Type:
  int

#### PdfSearchResultsWidget.searchResultData

searchResultData(item, role)

Public method to get data of a search result item.

item (QTreeWidgetItem)
  reference to the search result item
role (QPdfSearchModel.Role or Qt.ItemDataRole)
  item data role

Return:
  requested data

Return Type:
  Any

#### PdfSearchResultsWidget.searchString

searchString()

Public method to get the current search string.

Return:
  search string

Return Type:
  str

#### PdfSearchResultsWidget.setCurrentRow

setCurrentRow(row)

Public method to set the current row.

row (int)
  row number to make the current row

#### PdfSearchResultsWidget.setDocument

setDocument(document)

Public method to set the PDF document object to be searched.

document (QPdfDocument)
  reference to the PDF document object

#### PdfSearchResultsWidget.setSearchString

setSearchString(searchString)

Public method to set the search string.

searchString (str)
  search string

Up

## PdfSearchWidget

Class implementing a Search widget.

### Signals

searchCleared()
  emitted to indicate that the search results have been cleared
searchNextAvailable(bool)
  emitted to indicate the availability of search results after the current one
searchPrevAvailable(bool)
  emitted to indicate the availability of search results before the current one
searchResult(QPdfLink)
  emitted to send the link of a search result
searchResultActivated(QPdfLink)
  emitted to send the activated search result link

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

PdfSearchWidget | Constructor
__entrySelected | Private slot to handle the selection of a search result entry.
__handleDocumentStatus | Private slot to handle a change of the document status.
__search | Private slot to initiate a new search.
__searchTextChanged | Private slot to handle a change of the search string.
__updateInfoLabel | Private slot to update the data of the info label.
activateSearch | Public slot to 'activate' a search.
nextResult | Public slot to activate the next result.
previousResult | Public slot to activate the previous result.

### Static Methods

None

#### PdfSearchWidget (Constructor)

PdfSearchWidget(document, parent=None)

Constructor

document (QPdfDocument)
  reference to the PDF document object
parent (QWidget (optional))
  reference to the parent widget (defaults to None)

#### PdfSearchWidget.__entrySelected

__entrySelected(item)

Private slot to handle the selection of a search result entry.

item (QTreeWidgetItem)
  reference to the selected item

#### PdfSearchWidget.__handleDocumentStatus

__handleDocumentStatus(status)

Private slot to handle a change of the document status.

status (QPdfDocument.Status)
  document status

#### PdfSearchWidget.__search

__search()

Private slot to initiate a new search.

#### PdfSearchWidget.__searchTextChanged

__searchTextChanged(text)

Private slot to handle a change of the search string.

text (str)
  search string

#### PdfSearchWidget.__updateInfoLabel

__updateInfoLabel()

Private slot to update the data of the info label.

#### PdfSearchWidget.activateSearch

activateSearch()

Public slot to 'activate' a search.

#### PdfSearchWidget.nextResult

nextResult()

Public slot to activate the next result.

#### PdfSearchWidget.previousResult

previousResult()

Public slot to activate the previous result.

Up