Hi
I have written following code to find occurrences of a given text in whole text document. Following code will highlight all such occurrences. But when I click search down / search up buttons it doesn't move cursor to next occurrence. Can anyone please help to achieve this task.
bool bDown parameter is intended to be used to indicate whether to move cursor up/down. But Still I am clueless of how to use this parameter.

Qt Code:
Qt Code:
  1. QsciScintilla *m_pTextEdit;
  2.  
  3. void searchText( const QString& sText, bool bDown)
  4. {
  5. QString data = m_pTextEdit->text();
  6. m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICATORCLEARRANGE, 0, data.length());
  7.  
  8. if (sText.isEmpty())
  9. {
  10. return;
  11. }
  12.  
  13. int index = data.indexOf(sText, 0, Qt::CaseInsensitive);
  14.  
  15. while (index >= 0) {
  16. int length = sText.length();
  17. m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICSETSTYLE,0 ,QsciScintilla::INDIC_ROUNDBOX);
  18. m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICSETFORE, 0x007f00);
  19.  
  20. m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICATORFILLRANGE, index, length);
  21. index = data.indexOf(sText, index + length, Qt::CaseInsensitive);
  22. }
  23. }
To copy to clipboard, switch view to plain text mode 

Thanks in advance