# eric7.EricWidgets.EricTextEditSearchWidget

Module implementing a horizontal search widget for QTextEdit.

### Global Attributes

None

### Classes

EricTextEditSearchWidget | Class implementing a horizontal search widget for QTextEdit.
EricTextEditType | Class defining the supported text edit types.

### Functions

None

## EricTextEditSearchWidget

Class implementing a horizontal search widget for QTextEdit.

### Signals

closePressed()
  emitted to indicate the closing of the widget via the close button

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

EricTextEditSearchWidget | Constructor
__addWidthForHeightLayout | Private method to set the middle part of the layout.
__closeButtonClicked | Private slot to close the widget.
__find | Private method to search the associated text edit.
__findByReturnPressed | Private slot to handle the returnPressed signal of the findtext combobox.
__findPrevNextQTextEdit | Private method to to search the associated edit widget of type QTextEdit.
__findPrevNextQWebEngineView | Private method to to search the associated edit widget of type QWebEngineView.
__findTextFinished | Private method handling the find result of the web page search.
__setFindtextComboBackground | Private slot to change the findtext combo background to indicate errors.
__setSearchButtons | Private slot to set the state of the search buttons.
__setupUi | Private method to generate the UI.
activate | Public slot to activate the widget.
attachTextEdit | Public method to attach a QTextEdit or QWebEngineView widget.
deactivate | Public slot to deactivate the widget.
detachTextEdit | Public method to detach the current text edit.
findNext | Public slot to find the next occurrence of the current search term.
findPrev | Public slot to find the previous occurrence of the current search term.
keyPressEvent | Protected slot to handle key press events.
on_findNextButton_clicked | Private slot to find the next occurrence.
on_findPrevButton_clicked | Private slot to find the previous occurrence.
on_findtextCombo_editTextChanged | Private slot to enable/disable the find buttons.
setWidthForHeight | Public method to set the 'width for height'.
showInfo | Public method to show some information in the info label.

### Static Methods

None

#### EricTextEditSearchWidget (Constructor)

EricTextEditSearchWidget(parent=None, widthForHeight=True, enableClose=False)

Constructor

parent (QWidget)
  reference to the parent widget
widthForHeight (bool)
  flag indicating to prefer width for height. If this parameter is False, some widgets are shown in a third line.
enableClose (bool)
  flag indicating to show a close button

#### EricTextEditSearchWidget.__addWidthForHeightLayout

__addWidthForHeightLayout(widthForHeight)

Private method to set the middle part of the layout.

widthForHeight (bool)
  flag indicating to prefer width

#### EricTextEditSearchWidget.__closeButtonClicked

__closeButtonClicked()

Private slot to close the widget.

Note: The widget is just hidden.

#### EricTextEditSearchWidget.__find

__find(backwards)

Private method to search the associated text edit.

backwards (bool)
  flag indicating a backwards search

#### EricTextEditSearchWidget.__findByReturnPressed

__findByReturnPressed()

Private slot to handle the returnPressed signal of the findtext combobox.

#### EricTextEditSearchWidget.__findPrevNextQTextEdit

__findPrevNextQTextEdit(backwards)

Private method to to search the associated edit widget of type QTextEdit.

backwards (bool)
  flag indicating a backwards search

#### EricTextEditSearchWidget.__findPrevNextQWebEngineView

__findPrevNextQWebEngineView(backwards)

Private method to to search the associated edit widget of type QWebEngineView.

backwards (bool)
  flag indicating a backwards search

#### EricTextEditSearchWidget.__findTextFinished

__findTextFinished(result)

Private method handling the find result of the web page search.

Note: This method is used as the callback of the 'findText()' method call.

result (QWebEngineFindTextResult)
  reference to the QWebEngineFindTextResult object of the last search

#### EricTextEditSearchWidget.__setFindtextComboBackground

__setFindtextComboBackground(error)

Private slot to change the findtext combo background to indicate errors.

error (bool)
  flag indicating an error condition

#### EricTextEditSearchWidget.__setSearchButtons

__setSearchButtons(enabled)

Private slot to set the state of the search buttons.

enabled (bool)
  flag indicating the state

#### EricTextEditSearchWidget.__setupUi

__setupUi(widthForHeight, enableClose)

Private method to generate the UI.

widthForHeight (bool)
  flag indicating to prefer width for height
enableClose (bool)
  flag indicating to show a close button

#### EricTextEditSearchWidget.activate

activate()

Public slot to activate the widget.

#### EricTextEditSearchWidget.attachTextEdit

attachTextEdit(textedit, editType=EricTextEditType.QTEXTEDIT)

Public method to attach a QTextEdit or QWebEngineView widget.

textedit (QTextEdit, QTextBrowser or QWebEngineView)
  reference to the edit widget to be attached
editType (EricTextEditType)
  type of the attached edit widget

#### EricTextEditSearchWidget.deactivate

deactivate()

Public slot to deactivate the widget.

#### EricTextEditSearchWidget.detachTextEdit

detachTextEdit()

Public method to detach the current text edit.

#### EricTextEditSearchWidget.findNext

findNext()

Public slot to find the next occurrence of the current search term.

#### EricTextEditSearchWidget.findPrev

findPrev()

Public slot to find the previous occurrence of the current search term.

#### EricTextEditSearchWidget.keyPressEvent

keyPressEvent(event)

Protected slot to handle key press events.

event (QKeyEvent)
  reference to the key press event

#### EricTextEditSearchWidget.on_findNextButton_clicked

on_findNextButton_clicked()

Private slot to find the next occurrence.

#### EricTextEditSearchWidget.on_findPrevButton_clicked

on_findPrevButton_clicked()

Private slot to find the previous occurrence.

#### EricTextEditSearchWidget.on_findtextCombo_editTextChanged

on_findtextCombo_editTextChanged(txt)

Private slot to enable/disable the find buttons.

txt (str)
  text of the combobox

#### EricTextEditSearchWidget.setWidthForHeight

setWidthForHeight(widthForHeight)

Public method to set the 'width for height'.

widthForHeight (bool)
  flag indicating to prefer width

#### EricTextEditSearchWidget.showInfo

showInfo(info)

Public method to show some information in the info label.

info (str)
  informational text to be shown

Up

## EricTextEditType

Class defining the supported text edit types.

### Derived from

enum.Enum

### Class Attributes

QTEXTBROWSER
QTEXTEDIT
QWEBENGINEVIEW
UNKNOWN

### Class Methods

None

### Methods

None

### Static Methods

None

Up