Mantid
|
Raises a dialog allowing the user to find/replace text in the editor. More...
#include <FindReplaceDialog.h>
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... | |
ScriptEditor * | m_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... | |
Raises a dialog allowing the user to find/replace text in the editor.
Definition at line 31 of file FindReplaceDialog.h.
FindReplaceDialog::FindReplaceDialog | ( | ScriptEditor * | editor | ) |
|
protected |
Add replace box.
Definition at line 111 of file FindReplaceDialog.cpp.
References boxReplace, and m_topLayout.
Referenced by initLayout().
|
protected |
Add the replace buttons.
Definition at line 126 of file FindReplaceDialog.cpp.
References buttonReplace, buttonReplaceAll, m_vb2, replace(), and replaceAll().
Referenced by initLayout().
|
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().
|
protectedslot |
Find.
Find the current search term.
backwards | :: If true then the search procedes backwards from the cursor's current position |
Definition at line 145 of file FindReplaceDialog.cpp.
References boxCaseSensitive, boxFind, boxRegex, boxWholeWords, boxWrapAround, m_editor, and m_findInProgress.
Referenced by findClicked(), and replace().
|
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().
|
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().
|
protected |
Create the layout.
Create the widgets and lay them out.
Definition at line 36 of file FindReplaceDialog.cpp.
References addReplaceBox(), addReplaceButtons(), boxCaseSensitive, boxFind, boxRegex, boxSearchBackwards, boxWholeWords, boxWrapAround, buttonCancel, buttonNext, findClicked(), m_topLayout, m_vb2, and resetSearchFlags().
Referenced by FindDialog::FindDialog(), and FindReplaceDialog().
|
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().
|
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().
|
protectedslot |
Reset the search flags due to changes.
Definition at line 234 of file FindReplaceDialog.cpp.
References clearEditorSelection(), and findNotInProgress().
Referenced by initLayout().
|
overrideprivate |
Called when the widget is shown.
event | :: Parameterizes the dialog |
Definition at line 253 of file FindReplaceDialog.cpp.
|
private |
Case-sensitive check box.
Definition at line 84 of file FindReplaceDialog.h.
Referenced by find(), initLayout(), and replaceAll().
|
private |
Find box.
Definition at line 79 of file FindReplaceDialog.h.
Referenced by find(), initLayout(), replace(), replaceAll(), and showEvent().
|
private |
Treat as regular expressions.
Definition at line 92 of file FindReplaceDialog.h.
Referenced by find(), initLayout(), and replaceAll().
|
private |
Replace box.
Definition at line 81 of file FindReplaceDialog.h.
Referenced by addReplaceBox(), replace(), and replaceAll().
|
private |
Search backwards.
Definition at line 88 of file FindReplaceDialog.h.
Referenced by findClicked(), initLayout(), and replaceAll().
|
private |
Whole words check box.
Definition at line 86 of file FindReplaceDialog.h.
Referenced by find(), initLayout(), and replaceAll().
|
private |
Wrap around.
Definition at line 90 of file FindReplaceDialog.h.
Referenced by find(), initLayout(), and replaceAll().
|
private |
Cancel dialog button.
Definition at line 76 of file FindReplaceDialog.h.
Referenced by initLayout().
|
private |
Find next match button.
Definition at line 70 of file FindReplaceDialog.h.
Referenced by initLayout().
|
private |
Replace text button.
Definition at line 72 of file FindReplaceDialog.h.
Referenced by addReplaceButtons().
|
private |
Replace all text button.
Definition at line 74 of file FindReplaceDialog.h.
Referenced by addReplaceButtons().
|
private |
The text editor we are working on.
Definition at line 68 of file FindReplaceDialog.h.
Referenced by clearEditorSelection(), find(), replace(), replaceAll(), and showEvent().
|
private |
If a find is in progress.
Definition at line 95 of file FindReplaceDialog.h.
Referenced by find(), and findNotInProgress().
|
private |
Definition at line 97 of file FindReplaceDialog.h.
Referenced by addReplaceBox(), and initLayout().
|
private |
Definition at line 98 of file FindReplaceDialog.h.
Referenced by addReplaceButtons(), and initLayout().