Planned maintenance: From Sunday 8th December 10:00 CET there will be changes to try and solve the caching issues that have been experienced. If anyone has a problem connecting after this period then please PM @AndyS or any of the moderators.

Search up/down using QsciScintilla

  • 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.

    QsciScintilla *m_pTextEdit;

    void searchText( const QString& sText, bool bDown)
    QString data = m_pTextEdit->text();
    m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICATORCLEARRANGE, 0, data.length());

    if (sText.isEmpty())
    int index = data.indexOf(sText, 0,  Qt::CaseInsensitive);
    while (index >= 0) {
    int length = sText.length();
    m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICSETSTYLE,0 ,QsciScintilla::INDIC_ROUNDBOX);
    m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICSETFORE, 0x007f00);
    m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICATORFILLRANGE, index, length);
    index = data.indexOf(sText, index + length, Qt::CaseInsensitive);	 


  • Moderators

    Hi @Yatshan, and welcome to the Qt Dev Net!

    Sorry I don't have any experience with Scintilla, so I don't know how to solve your problem. Have you tried asking the person who created QsciScintilla?