我想真正高亮地看到我在编辑器中使用QScintilla找到的所有单词

时间:2015-11-10 08:49:22

标签: scintilla qscintilla

这是我想要的效果:

enter image description here

这是实际效果。

enter image description here

//follow is code i code:
SendScintilla(QsciScintillaBase::SCI_INDICSETSTYLE,0, INDIC_ROUNDBOX);
SendScintilla(QsciScintillaBase::SCI_INDICSETFORE,0, QColor(Qt::yellow));

1 个答案:

答案 0 :(得分:0)

This is my answer.

SendScintilla(QsciScintillaBase::SCI_INDICSETSTYLE,0, INDIC_BOX);

QString docText = text();
int end = docText.lastIndexOf(findText);
int cur = -1; 

if(end != -1) {

   while(cur != end) {
        cur = docText.indexOf(findText,cur+1);`
        SendScintilla(QsciScintillaBase::SCI_INDICATORFILLRANGE,cur,
            findText.length());
   }

}