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!!!!!!

Qt Code:
  1. cursor->movePosition(QTextCursor::End);
  2.  
  3. while(!cursor->atStart())
  4. {
  5.  
  6. //cursor->setCharFormat(format);
  7. cursor->select(QTextCursor::WordUnderCursor);
  8. QString s=cursor->selectedText();
  9.  
  10. if(s.contains(findlinededit->text(),Qt::CaseInsensitive))
  11. {
  12. .................//this is used to change the color of the text when it is found!!
  13. }
  14. cursor->movePosition(QTextCursor::WordLeft,QTextCursor::KeepAnchor);
  15.  
  16. }//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.