Buttons: Replace, Find & Replace, Replace All, Switch to Project Search
Approach
Create the UI in qml
Whenever a keypress happens, the "Find" action is triggered
When "Find" is triggered:
Create and use lveditor/DocumentHandler::findText to find the text for the document
If the search text is different than the previous search text:
Clear the previous highlighting model
Search the text and create the new model
Reghighlight the doucment with each of those sections
Return the next index
Place the cursor on the index of the next highlight
When "Replace" is triggered:
Create and uselveditor/DocumentHandler::replace to replace the cursor index of the document
When "Find & Replace" is triggered:
Create and use lveditor/ProjectDocument::replace to replace the cursor index of the document
Return the next index
Place the cursor on the index of the next highlight
When "Replace all" is triggered:
Create and use lveditor/ProjectDocument::replaceAll to replace all the instances
Clear all highlighting
2. Search and replace within a project
UI
Input Boxes: Search box, Replace Box
Buttons: Find, Replace All
Approach
Create the UI in qml
When "Find" is triggered:
Create and use lveditor/Project::findText to find the text in the project, a ListModel with the items
is returned. The ListModel contains the path to the file, then the findings in the
file, like line number, offset and fragment with the actual text
The model is displayed as a List of files and when collpsed, the findings are displayed
When "Replace all" is triggered:
Use lveditor/Project::replaceText to replace the text in the project
There are 2 types:
1. Search and replace within a document
UI
Approach
Create the UI in qml
Whenever a keypress happens, the "Find" action is triggered
When "Find" is triggered:
Create and use
lveditor/DocumentHandler::findText
to find the text for the documentIf the search text is different than the previous search text:
Return the next index
Place the cursor on the index of the next highlight
When "Replace" is triggered:
lveditor/DocumentHandler::replace
to replace the cursor index of the documentWhen "Find & Replace" is triggered:
Create and use
lveditor/ProjectDocument::replace
to replace the cursor index of the documentReturn the next index
Place the cursor on the index of the next highlight
When "Replace all" is triggered:
Create and use
lveditor/ProjectDocument::replaceAll
to replace all the instancesClear all highlighting
2. Search and replace within a project
UI
Approach
Create the UI in qml
When "Find" is triggered:
Create and use
lveditor/Project::findText
to find the text in the project, a ListModel with the items is returned. The ListModel contains the path to the file, then the findings in the file, like line number, offset and fragment with the actual textThe model is displayed as a List of files and when collpsed, the findings are displayed
When "Replace all" is triggered:
Use
lveditor/Project::replaceText
to replace the text in the projectClear the current model