Replace text from where user left the cursor
-
Hi,
I developed a Find/Replace feature for my editor. In case of replaceText(), the text is being replaced from the start of the document. Ideally, it should start replacing from where the user left the cursor position. Please help me regarding this.
My code:
@
void MyEditor::replaceText(const QString &findWord, const QString &replaceWord)
{
if(textEdit->find(findWord, QTextDocument::FindCaseSensitively))
{
textEdit->insertPlainText(replaceWord);
}
}
@
I need to start replacing text not from START of doc, but from where user had left the cursor.Thanks,
Haney.[edit] code wrappings added, koahnig
-
Please use "code wrappings":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 when posting code sections