# eric7.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.
replace | Public method to replace the current selection.
replaceAll | Public method to replace all occurrences.
replaceSearch | Public method to replace the current selection and search again.
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.replace

replace()

Public method to replace the current selection.

#### SearchReplaceSlidingWidget.replaceAll

replaceAll()

Public method to replace all occurrences.

#### SearchReplaceSlidingWidget.replaceSearch

replaceSearch()

Public method to replace the current selection and search again.

#### SearchReplaceSlidingWidget.resizeEvent

resizeEvent(evt)

Protected method to handle resize events.

evt
  reference to the resize event (QResizeEvent)

#### SearchReplaceSlidingWidget.selectionChanged

selectionChanged(editor)

Public slot tracking changes of selected text.

editor (Editor)
  reference to the editor

#### 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.
__quickSearch | Private slot to search for the entered text while typing.
__quickSearchMarkOccurrences | Private method to mark all occurrences of the search text.
__selectionBoundary | Private method to calculate the current selection boundary.
__setFindNextEnabled | Private method to set the enabled state of "Find Next".
__setFindPrevEnabled | Private method to set the enabled state of "Find Prev".
__setReplaceAllEnabled | Private method to set the enabled state of "Replace All".
__setReplaceAndSearchEnabled | Private method to set the enabled state of "Replace And Search".
__setReplaceSelectionEnabled | Private method to set the enabled state of "Replace Occurrence".
__setSearchEditColors | Private method to set the search edit colors.
__setShortcuts | Private method to set the local action's shortcuts to the same key sequences as in the view manager.
__showFind | Private method to display this widget in find mode.
__showReplace | Private slot to display this widget in replace mode.
__updateQuickSearchMarkers | Private slot to handle the selection of the various check boxes.
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_extendButton_clicked | Private slot to handle the quicksearch extend action.
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.
replace | Public method to replace the current selection.
replaceAll | Public method to replace all occurrences.
replaceSearch | Public method to replace the current selection and search again.
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)

Return:
  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.__quickSearch

__quickSearch(txt)

Private slot to search for the entered text while typing.

txt (str)
  text of the search edit

#### SearchReplaceWidget.__quickSearchMarkOccurrences

__quickSearchMarkOccurrences(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)

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

#### SearchReplaceWidget.__setFindNextEnabled

__setFindNextEnabled(enable)

Private method to set the enabled state of "Find Next".

enable (bool)
  flag indicating the enable state to be set

#### SearchReplaceWidget.__setFindPrevEnabled

__setFindPrevEnabled(enable)

Private method to set the enabled state of "Find Prev".

enable (bool)
  flag indicating the enable state to be set

#### SearchReplaceWidget.__setReplaceAllEnabled

__setReplaceAllEnabled(enable)

Private method to set the enabled state of "Replace All".

enable (bool)
  flag indicating the enable state to be set

#### SearchReplaceWidget.__setReplaceAndSearchEnabled

__setReplaceAndSearchEnabled(enable)

Private method to set the enabled state of "Replace And Search".

enable (bool)
  flag indicating the enable state to be set

#### SearchReplaceWidget.__setReplaceSelectionEnabled

__setReplaceSelectionEnabled(enable)

Private method to set the enabled state of "Replace Occurrence".

enable (bool)
  flag indicating the enable state to be set

#### SearchReplaceWidget.__setSearchEditColors

__setSearchEditColors(ok)

Private method to set the search edit colors.

ok (bool)
  flag indicating a match

#### SearchReplaceWidget.__setShortcuts

__setShortcuts()

Private method to set the local action's shortcuts to the same key sequences as in the view manager.

#### 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.__updateQuickSearchMarkers

__updateQuickSearchMarkers(on)

Private slot to handle the selection of the various check boxes.

on (bool)
  status of the check box (ignored)

#### 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_extendButton_clicked

on_extendButton_clicked()

Private slot to handle the quicksearch extend action.

#### 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 (str)
  text of the find text combo

#### 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.replace

replace()

Public method to replace the current selection.

#### SearchReplaceWidget.replaceAll

replaceAll()

Public method to replace all occurrences.

#### SearchReplaceWidget.replaceSearch

replaceSearch()

Public method to replace the current selection and search again.

#### SearchReplaceWidget.selectionChanged

selectionChanged(editor)

Public slot tracking changes of selected text.

editor (Editor)
  reference to the editor

#### 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 (Editor)
  reference to the editor

Up