Mantid
Loading...
Searching...
No Matches
Public Member Functions | Protected Slots | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
FindReplaceDialog Class Reference

Raises a dialog allowing the user to find/replace text in the editor. More...

#include <FindReplaceDialog.h>

Inheritance diagram for FindReplaceDialog:
MantidQt::API::MantidDialog FindDialog

Public Member Functions

 FindReplaceDialog (ScriptEditor *editor)
 Constructor. More...
 
- Public Member Functions inherited from MantidQt::API::MantidDialog
 MantidDialog (QWidget *parent=nullptr, const Qt::WindowFlags &flags=Qt::WindowCloseButtonHint|Qt::WindowType::WindowTitleHint)
 DefaultConstructor. More...
 
 ~MantidDialog () override
 Destructor. More...
 

Protected Slots

void clearEditorSelection ()
 Clear the editor selection. More...
 
bool find (bool backwards=false)
 Find. More...
 
void findClicked ()
 A slot for the findClicked button. More...
 
void findNotInProgress ()
 Set the flag about whether we are currently finding. More...
 
void replace ()
 Replace slot. More...
 
void replaceAll ()
 Replace all slot. More...
 
void resetSearchFlags ()
 Reset the search flags due to changes. More...
 

Protected Member Functions

void addReplaceBox ()
 Add replace box. More...
 
void addReplaceButtons ()
 Add the replace buttons. More...
 
void initLayout ()
 Create the layout. More...
 
- Protected Member Functions inherited from MantidQt::API::MantidDialog
virtual void handleException (const std::exception &e)
 Override this method to handle an exception in a derived class. More...
 
QString runPythonCode (const QString &code, bool no_output=false)
 Run python code that is passed to it and, optionally, return anything it wrote to standard output as a string. More...
 

Private Member Functions

void showEvent (QShowEvent *event) override
 Called when the widget is shown. More...
 

Private Attributes

QCheckBox * boxCaseSensitive
 Case-sensitive check box. More...
 
QComboBox * boxFind
 Find box. More...
 
QCheckBox * boxRegex
 Treat as regular expressions. More...
 
QComboBox * boxReplace
 Replace box. More...
 
QCheckBox * boxSearchBackwards
 Search backwards. More...
 
QCheckBox * boxWholeWords
 Whole words check box. More...
 
QCheckBox * boxWrapAround
 Wrap around. More...
 
QPushButton * buttonCancel
 Cancel dialog button. More...
 
QPushButton * buttonNext
 Find next match button. More...
 
QPushButton * buttonReplace
 Replace text button. More...
 
QPushButton * buttonReplaceAll
 Replace all text button. More...
 
ScriptEditorm_editor
 The text editor we are working on. More...
 
bool m_findInProgress
 If a find is in progress. More...
 
QGridLayout * m_topLayout
 
QVBoxLayout * m_vb2
 

Additional Inherited Members

- Signals inherited from MantidQt::API::MantidDialog
void runAsPythonScript (const QString &code, bool)
 
- Static Public Member Functions inherited from MantidQt::API::MantidDialog
static bool handle (QObject *receiver, const std::exception &e)
 Handles the exception caught in an event handler. More...
 

Detailed Description

Raises a dialog allowing the user to find/replace text in the editor.

Definition at line 31 of file FindReplaceDialog.h.

Constructor & Destructor Documentation

◆ FindReplaceDialog()

FindReplaceDialog::FindReplaceDialog ( ScriptEditor editor)

Constructor.

Definition at line 27 of file FindReplaceDialog.cpp.

References initLayout().

Member Function Documentation

◆ addReplaceBox()

void FindReplaceDialog::addReplaceBox ( )
protected

Add replace box.

Definition at line 111 of file FindReplaceDialog.cpp.

References boxReplace, and m_topLayout.

Referenced by initLayout().

◆ addReplaceButtons()

void FindReplaceDialog::addReplaceButtons ( )
protected

Add the replace buttons.

Definition at line 126 of file FindReplaceDialog.cpp.

References buttonReplace, buttonReplaceAll, m_vb2, replace(), and replaceAll().

Referenced by initLayout().

◆ clearEditorSelection

void FindReplaceDialog::clearEditorSelection ( )
protectedslot

Clear the editor selection.

Clear the selection in the editor.

Definition at line 247 of file FindReplaceDialog.cpp.

References m_editor.

Referenced by resetSearchFlags().

◆ find

bool FindReplaceDialog::find ( bool  backwards = false)
protectedslot

Find.

Find the current search term.

Parameters
backwards:: If true then the search procedes backwards from the cursor's current position
Returns
A boolean indicating success/failure

Definition at line 145 of file FindReplaceDialog.cpp.

References boxCaseSensitive, boxFind, boxRegex, boxWholeWords, boxWrapAround, m_editor, and m_findInProgress.

Referenced by findClicked(), and replace().

◆ findClicked

void FindReplaceDialog::findClicked ( )
protectedslot

A slot for the findClicked button.

Find button clicked slot.

Definition at line 228 of file FindReplaceDialog.cpp.

References boxSearchBackwards, and find().

Referenced by initLayout().

◆ findNotInProgress

void FindReplaceDialog::findNotInProgress ( )
protectedslot

Set the flag about whether we are currently finding.

Flip the in-progress flag.

Definition at line 242 of file FindReplaceDialog.cpp.

References m_findInProgress.

Referenced by resetSearchFlags().

◆ initLayout()

void FindReplaceDialog::initLayout ( )
protected

◆ replace

void FindReplaceDialog::replace ( )
protectedslot

Replace slot.

Replace the next occurrence of the search term with the replacement text.

Definition at line 173 of file FindReplaceDialog.cpp.

References boxFind, boxReplace, find(), and m_editor.

Referenced by addReplaceButtons().

◆ replaceAll

void FindReplaceDialog::replaceAll ( )
protectedslot

Replace all slot.

Replace all occurrences of the current search term with the replacement text.

Definition at line 199 of file FindReplaceDialog.cpp.

References boxCaseSensitive, boxFind, boxRegex, boxReplace, boxSearchBackwards, boxWholeWords, boxWrapAround, m_editor, and ScriptEditor::replaceAll().

Referenced by addReplaceButtons().

◆ resetSearchFlags

void FindReplaceDialog::resetSearchFlags ( )
protectedslot

Reset the search flags due to changes.

Definition at line 234 of file FindReplaceDialog.cpp.

References clearEditorSelection(), and findNotInProgress().

Referenced by initLayout().

◆ showEvent()

void FindReplaceDialog::showEvent ( QShowEvent *  event)
overrideprivate

Called when the widget is shown.

Parameters
event:: Parameterizes the dialog

Definition at line 253 of file FindReplaceDialog.cpp.

References boxFind, and m_editor.

Member Data Documentation

◆ boxCaseSensitive

QCheckBox* FindReplaceDialog::boxCaseSensitive
private

Case-sensitive check box.

Definition at line 84 of file FindReplaceDialog.h.

Referenced by find(), initLayout(), and replaceAll().

◆ boxFind

QComboBox* FindReplaceDialog::boxFind
private

Find box.

Definition at line 79 of file FindReplaceDialog.h.

Referenced by find(), initLayout(), replace(), replaceAll(), and showEvent().

◆ boxRegex

QCheckBox* FindReplaceDialog::boxRegex
private

Treat as regular expressions.

Definition at line 92 of file FindReplaceDialog.h.

Referenced by find(), initLayout(), and replaceAll().

◆ boxReplace

QComboBox* FindReplaceDialog::boxReplace
private

Replace box.

Definition at line 81 of file FindReplaceDialog.h.

Referenced by addReplaceBox(), replace(), and replaceAll().

◆ boxSearchBackwards

QCheckBox* FindReplaceDialog::boxSearchBackwards
private

Search backwards.

Definition at line 88 of file FindReplaceDialog.h.

Referenced by findClicked(), initLayout(), and replaceAll().

◆ boxWholeWords

QCheckBox* FindReplaceDialog::boxWholeWords
private

Whole words check box.

Definition at line 86 of file FindReplaceDialog.h.

Referenced by find(), initLayout(), and replaceAll().

◆ boxWrapAround

QCheckBox* FindReplaceDialog::boxWrapAround
private

Wrap around.

Definition at line 90 of file FindReplaceDialog.h.

Referenced by find(), initLayout(), and replaceAll().

◆ buttonCancel

QPushButton* FindReplaceDialog::buttonCancel
private

Cancel dialog button.

Definition at line 76 of file FindReplaceDialog.h.

Referenced by initLayout().

◆ buttonNext

QPushButton* FindReplaceDialog::buttonNext
private

Find next match button.

Definition at line 70 of file FindReplaceDialog.h.

Referenced by initLayout().

◆ buttonReplace

QPushButton* FindReplaceDialog::buttonReplace
private

Replace text button.

Definition at line 72 of file FindReplaceDialog.h.

Referenced by addReplaceButtons().

◆ buttonReplaceAll

QPushButton* FindReplaceDialog::buttonReplaceAll
private

Replace all text button.

Definition at line 74 of file FindReplaceDialog.h.

Referenced by addReplaceButtons().

◆ m_editor

ScriptEditor* FindReplaceDialog::m_editor
private

The text editor we are working on.

Definition at line 68 of file FindReplaceDialog.h.

Referenced by clearEditorSelection(), find(), replace(), replaceAll(), and showEvent().

◆ m_findInProgress

bool FindReplaceDialog::m_findInProgress
private

If a find is in progress.

Definition at line 95 of file FindReplaceDialog.h.

Referenced by find(), and findNotInProgress().

◆ m_topLayout

QGridLayout* FindReplaceDialog::m_topLayout
private

Definition at line 97 of file FindReplaceDialog.h.

Referenced by addReplaceBox(), and initLayout().

◆ m_vb2

QVBoxLayout* FindReplaceDialog::m_vb2
private

Definition at line 98 of file FindReplaceDialog.h.

Referenced by addReplaceButtons(), and initLayout().


The documentation for this class was generated from the following files: