Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- QTextCursor highlightCursor(document);
- QTextCursor cursor(document);
- cursor.beginEditBlock();
- QTextCharFormat plainFormat(highlightCursor.charFormat());
- QTextCharFormat colorFormat = plainFormat;
- colorFormat.setBackground(Qt::yellow);
- while (!highlightCursor.isNull() && !highlightCursor.atEnd())
- {
- // p.setColor(QPalette::Base, QColor("#f8f8f8"));
- //XXX if (searchTextList.contains())
- if (!highlightCursor.isNull())
- {
- count++;
- // QTextDocument::FindCaseSensitively, wholeword 는 QTextDocument::FindWholeWords임
- highlightCursor = document->find(strsearch, highlightCursor, 0);
- highlightCursor.movePosition(QTextCursor::WordRight, QTextCursor::KeepAnchor);
- highlightCursor.mergeCharFormat(colorFormat);
- isSearch = true;
- }
- }
- cursor.endEditBlock();
- if (isSearch)
- searchTextList.append(strsearch);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement