# eric6.QScintilla.SearchReplaceWidget

Module implementing the search and replace widget.

### Global Attributes

None

### Classes

SearchReplaceSlidingWidget | Class implementing the search and replace widget with sliding behavior.
SearchReplaceWidget | Class implementing the search and replace widget.

### Functions

None

## SearchReplaceSlidingWidget

Class implementing the search and replace widget with sliding behavior.

### Signals

searchListChanged()
  emitted to indicate a change of the search list

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

SearchReplaceSlidingWidget | Constructor
__enableScrollerButtons | Private method to set the enabled state of the scroll buttons.
__slide | Private method to move the sliding widget.
__slideLeft | Private slot to move the widget to the left, i.e.
__slideRight | Private slot to move the widget to the right, i.e.
changeEvent | Protected method handling state changes.
findNext | Public slot to find the next occurrence of text.
findPrev | Public slot to find the next previous of text.
resizeEvent | Protected method to handle resize events.
selectionChanged | Public slot tracking changes of selected text.
show | Public slot to show the widget.
updateSelectionCheckBox | Public slot to update the selection check box.

### Static Methods

None

#### SearchReplaceSlidingWidget (Constructor)

SearchReplaceSlidingWidget(replace, vm, parent=None)

Constructor

replace
  flag indicating a replace widget is called
vm
  reference to the viewmanager object
parent
  parent widget of this widget (QWidget)

#### SearchReplaceSlidingWidget.__enableScrollerButtons

__enableScrollerButtons()

Private method to set the enabled state of the scroll buttons.

#### SearchReplaceSlidingWidget.__slide

__slide(toLeft)

Private method to move the sliding widget.

toLeft
  flag indicating to move to the left (boolean)

#### SearchReplaceSlidingWidget.__slideLeft

__slideLeft()

Private slot to move the widget to the left, i.e. show contents to the right.

#### SearchReplaceSlidingWidget.__slideRight

__slideRight()

Private slot to move the widget to the right, i.e. show contents to the left.

#### SearchReplaceSlidingWidget.changeEvent

changeEvent(evt)

Protected method handling state changes.

evt
  event containing the state change (QEvent)

#### SearchReplaceSlidingWidget.findNext

findNext()

Public slot to find the next occurrence of text.

#### SearchReplaceSlidingWidget.findPrev

findPrev()

Public slot to find the next previous of text.

#### SearchReplaceSlidingWidget.resizeEvent

resizeEvent(evt)

Protected method to handle resize events.

evt
  reference to the resize event (QResizeEvent)

#### SearchReplaceSlidingWidget.selectionChanged

selectionChanged()

Public slot tracking changes of selected text.

#### SearchReplaceSlidingWidget.show

show(text='')

Public slot to show the widget.

text
  text to be shown in the findtext edit (string)

#### SearchReplaceSlidingWidget.updateSelectionCheckBox

updateSelectionCheckBox(editor)

Public slot to update the selection check box.

editor
  reference to the editor (Editor)

Up

## SearchReplaceWidget

Class implementing the search and replace widget.

### Signals

searchListChanged()
  emitted to indicate a change of the search list

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

SearchReplaceWidget | Constructor
__doReplace | Private method to replace one occurrence of text.
__findByReturnPressed | Private slot to handle the returnPressed signal of the findtext combobox.
__findNextPrev | Private method to find the next occurrence of the search text.
__markOccurrences | Private method to mark all occurrences of the search text.
__selectionBoundary | Private method to calculate the current selection boundary.
__showFind | Private method to display this widget in find mode.
__showReplace | Private slot to display this widget in replace mode.
changeEvent | Protected method handling state changes.
findNext | Public slot to find the next occurrence of text.
findPrev | Public slot to find the next previous of text.
keyPressEvent | Protected slot to handle key press events.
on_closeButton_clicked | Private slot to close the widget.
on_findNextButton_clicked | Private slot to find the next occurrence of text.
on_findPrevButton_clicked | Private slot to find the previous occurrence of text.
on_findtextCombo_editTextChanged | Private slot to enable/disable the find buttons.
on_replaceAllButton_clicked | Private slot to replace all occurrences of text.
on_replaceButton_clicked | Private slot to replace one occurrence of text.
on_replaceSearchButton_clicked | Private slot to replace one occurrence of text and search for the next one.
selectionChanged | Public slot tracking changes of selected text.
show | Public slot to show the widget.
updateSelectionCheckBox | Public slot to update the selection check box.

### Static Methods

None

#### SearchReplaceWidget (Constructor)

SearchReplaceWidget(replace, vm, parent=None, sliding=False)

Constructor

replace
  flag indicating a replace widget is called
vm
  reference to the viewmanager object
parent
  parent widget of this widget (QWidget)
sliding
  flag indicating the widget is embedded in the sliding widget (boolean)

#### SearchReplaceWidget.__doReplace

__doReplace(searchNext)

Private method to replace one occurrence of text.

searchNext
  flag indicating to search for the next occurrence (boolean).

#### SearchReplaceWidget.__findByReturnPressed

__findByReturnPressed()

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

#### SearchReplaceWidget.__findNextPrev

__findNextPrev(txt, backwards)

Private method to find the next occurrence of the search text.

txt
  text to search for (string)
backwards
  flag indicating a backwards search (boolean)

Returns:
  flag indicating success (boolean)

#### SearchReplaceWidget.__markOccurrences

__markOccurrences(txt)

Private method to mark all occurrences of the search text.

txt
  text to search for (string)

#### SearchReplaceWidget.__selectionBoundary

__selectionBoundary(selections=None)

Private method to calculate the current selection boundary.

selections
  optional parameter giving the selections to calculate the boundary for (list of tuples of four integer)

Returns:
  tuple of start line and index and end line and index (tuple of four integer)

#### SearchReplaceWidget.__showFind

__showFind(text='')

Private method to display this widget in find mode.

text
  text to be shown in the findtext edit (string)

#### SearchReplaceWidget.__showReplace

__showReplace(text='')

Private slot to display this widget in replace mode.

text
  text to be shown in the findtext edit

#### SearchReplaceWidget.changeEvent

changeEvent(evt)

Protected method handling state changes.

evt
  event containing the state change (QEvent)

#### SearchReplaceWidget.findNext

findNext()

Public slot to find the next occurrence of text.

#### SearchReplaceWidget.findPrev

findPrev()

Public slot to find the next previous of text.

#### SearchReplaceWidget.keyPressEvent

keyPressEvent(event)

Protected slot to handle key press events.

event
  reference to the key press event (QKeyEvent)

#### SearchReplaceWidget.on_closeButton_clicked

on_closeButton_clicked()

Private slot to close the widget.

#### SearchReplaceWidget.on_findNextButton_clicked

on_findNextButton_clicked()

Private slot to find the next occurrence of text.

#### SearchReplaceWidget.on_findPrevButton_clicked

on_findPrevButton_clicked()

Private slot to find the previous occurrence of text.

#### SearchReplaceWidget.on_findtextCombo_editTextChanged

on_findtextCombo_editTextChanged(txt)

Private slot to enable/disable the find buttons.

txt
  text of the find text combo (string)

#### SearchReplaceWidget.on_replaceAllButton_clicked

on_replaceAllButton_clicked()

Private slot to replace all occurrences of text.

#### SearchReplaceWidget.on_replaceButton_clicked

on_replaceButton_clicked()

Private slot to replace one occurrence of text.

#### SearchReplaceWidget.on_replaceSearchButton_clicked

on_replaceSearchButton_clicked()

Private slot to replace one occurrence of text and search for the next one.

#### SearchReplaceWidget.selectionChanged

selectionChanged()

Public slot tracking changes of selected text.

#### SearchReplaceWidget.show

show(text='')

Public slot to show the widget.

text
  text to be shown in the findtext edit (string)

#### SearchReplaceWidget.updateSelectionCheckBox

updateSelectionCheckBox(editor)

Public slot to update the selection check box.

editor
  reference to the editor (Editor)

Up