# eric6.E5Gui.E5TextEditSearchWidget

Module implementing a horizontal search widget for QTextEdit.

### Global Attributes

None

### Classes

E5TextEditSearchWidget | Class implementing a horizontal search widget for QTextEdit.

### Functions

None

## E5TextEditSearchWidget

Class implementing a horizontal search widget for QTextEdit.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

E5TextEditSearchWidget | Constructor
__addWidthForHeightLayout | Private method to set the middle part of the layout.
__find | Private method to search the associated text edit.
__findByReturnPressed | Private slot to handle the returnPressed signal of the findtext combobox.
__findNextPrevCallback | Private method to process the result of the last search.
__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.
__findPrevNextQWebView | Private method to to search the associated edit widget of type QWebView.
__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.
attachTextEdit | Public method to attach a QTextEdit widget.
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'.

### Static Methods

None

#### E5TextEditSearchWidget (Constructor)

E5TextEditSearchWidget(parent=None, widthForHeight=True)

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.

#### E5TextEditSearchWidget.__addWidthForHeightLayout

__addWidthForHeightLayout(widthForHeight)

Private method to set the middle part of the layout.

widthForHeight (bool)
  flag indicating to prefer width

#### E5TextEditSearchWidget.__find

__find(backwards)

Private method to search the associated text edit.

backwards
  flag indicating a backwards search (boolean)

#### E5TextEditSearchWidget.__findByReturnPressed

__findByReturnPressed()

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

#### E5TextEditSearchWidget.__findNextPrevCallback

__findNextPrevCallback(found)

Private method to process the result of the last search.

found (bool)
  flag indicating if the last search succeeded

#### E5TextEditSearchWidget.__findPrevNextQTextEdit

__findPrevNextQTextEdit(backwards)

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

backwards (bool)
  flag indicating a backwards search

Returns:
  flag indicating the search result

Return Type:
  bool

#### E5TextEditSearchWidget.__findPrevNextQWebEngineView

__findPrevNextQWebEngineView(backwards)

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

backwards (bool)
  flag indicating a backwards search

#### E5TextEditSearchWidget.__findPrevNextQWebView

__findPrevNextQWebView(backwards)

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

backwards (bool)
  flag indicating a backwards search

Returns:
  flag indicating the search result

Return Type:
  bool

#### E5TextEditSearchWidget.__setFindtextComboBackground

__setFindtextComboBackground(error)

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

error
  flag indicating an error condition (boolean)

#### E5TextEditSearchWidget.__setSearchButtons

__setSearchButtons(enabled)

Private slot to set the state of the search buttons.

enabled
  flag indicating the state (boolean)

#### E5TextEditSearchWidget.__setupUi

__setupUi(widthForHeight)

Private method to generate the UI.

widthForHeight (bool)
  flag indicating to prefer width for height

#### E5TextEditSearchWidget.attachTextEdit

attachTextEdit(textedit, editType="QTextEdit")

Public method to attach a QTextEdit widget.

textedit (QTextEdit, QWebEngineView or QWebView)
  reference to the edit widget to be attached
editType (str (one of "QTextEdit", "QWebEngineView" or "QWebView"))
  type of the attached edit widget

#### E5TextEditSearchWidget.keyPressEvent

keyPressEvent(event)

Protected slot to handle key press events.

event
  reference to the key press event (QKeyEvent)

#### E5TextEditSearchWidget.on_findNextButton_clicked

on_findNextButton_clicked()

Private slot to find the next occurrence.

#### E5TextEditSearchWidget.on_findPrevButton_clicked

on_findPrevButton_clicked()

Private slot to find the previous occurrence.

#### E5TextEditSearchWidget.on_findtextCombo_editTextChanged

on_findtextCombo_editTextChanged(txt)

Private slot to enable/disable the find buttons.

txt
  text of the combobox (string)

#### E5TextEditSearchWidget.setWidthForHeight

setWidthForHeight(widthForHeight)

Public method to set the 'width for height'.

widthForHeight (bool)
  flag indicating to prefer width

Up