I am trying to implement the Findtext function in QTextEdit. I can find text using the FindNext function.
BUT when i am trying to find the Text using the FindPrevious function , am getting some problem.
Help me out!!!!!!
while(!cursor->atStart())
{
//cursor->setCharFormat(format);
if(s.contains(findlinededit->text(),Qt::CaseInsensitive))
{
.................//this is used to change the color of the text when it is found!!
}
}//end of while
cursor->movePosition(QTextCursor::End);
while(!cursor->atStart())
{
//cursor->setCharFormat(format);
cursor->select(QTextCursor::WordUnderCursor);
QString s=cursor->selectedText();
if(s.contains(findlinededit->text(),Qt::CaseInsensitive))
{
.................//this is used to change the color of the text when it is found!!
}
cursor->movePosition(QTextCursor::WordLeft,QTextCursor::KeepAnchor);
}//end of while
To copy to clipboard, switch view to plain text mode
Even i tried using the QTextCursor::PreviousWord. The Problem is when i click the FindPrevious Button it is searching only the first word.
Bookmarks