void searchText( const QString& sText, bool bDown)
{
QString data
= m_pTextEdit
->text
();
m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICATORCLEARRANGE, 0, data.length());
if (sText.isEmpty())
{
return;
}
int index = data.indexOf(sText, 0, Qt::CaseInsensitive);
int length = sText.length();
if (bDown == true)
{
m_pTextEdit->SendScintilla(QsciScintilla::SCI_SETANCHOR, index);
m_pTextEdit->SendScintilla(QsciScintilla::SCI_SETCURRENTPOS, index);
m_pTextEdit->SendScintilla(QsciScintilla::SCI_SCROLLCARET, 0);
edit_SearchText->setFocus();
}
while (index >= 0) {
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);
}
}
void searchText( const QString& sText, bool bDown)
{
QString data = m_pTextEdit->text();
m_pTextEdit->SendScintilla(QsciScintilla::SCI_INDICATORCLEARRANGE, 0, data.length());
if (sText.isEmpty())
{
return;
}
int index = data.indexOf(sText, 0, Qt::CaseInsensitive);
int length = sText.length();
if (bDown == true)
{
m_pTextEdit->SendScintilla(QsciScintilla::SCI_SETANCHOR, index);
m_pTextEdit->SendScintilla(QsciScintilla::SCI_SETCURRENTPOS, index);
m_pTextEdit->SendScintilla(QsciScintilla::SCI_SCROLLCARET, 0);
edit_SearchText->setFocus();
}
while (index >= 0) {
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);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks