MCPcopy Create free account
hub / github.com/cxasm/notepad-- / clearHighlightWord

Method clearHighlightWord

src/cceditor/ccnotepad.cpp:7064–7109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7062}
7063
7064void CCNotePad::clearHighlightWord(QString signWord, ScintillaEditView* pEdit)
7065{
7066 if (pEdit == nullptr)
7067 {
7068 QWidget* pw = ui.editTabWidget->currentWidget();
7069 pEdit = dynamic_cast<ScintillaEditView*>(pw);
7070
7071 if (HEX_TYPE == getDocTypeProperty(pw) || (pEdit == nullptr))
7072 {
7073 return;
7074 }
7075 }
7076
7077 //如果当前已经高亮,则取消高亮
7078 QList<FindRecords*>& curMarkRecord = pEdit->getCurMarkRecord();
7079
7080 bool isClearMark = false;
7081
7082 int i = 0;
7083 for (; i < curMarkRecord.size(); ++i)
7084 {
7085 if (signWord == curMarkRecord.at(i)->findText)
7086 {
7087 isClearMark = true;
7088 break;
7089 }
7090 }
7091
7092 if (isClearMark)
7093 {
7094 //取消高亮
7095 FindRecords* r = curMarkRecord.at(i);
7096
7097 pEdit->execute(SCI_SETINDICATORCURRENT, r->hightLightColor);
7098
7099 for (int j = 0; j < r->records.size(); ++j)
7100 {
7101 const FindRecord& oneRecord = r->records.at(j);
7102 pEdit->execute(SCI_INDICATORCLEARRANGE, oneRecord.pos, oneRecord.end - oneRecord.pos);
7103 }
7104
7105 //必须删除释放,否则内存泄露
7106 delete r;
7107 curMarkRecord.removeAt(i);
7108 }
7109 }
7110
7111void CCNotePad::slot_clearWordHighlight()
7112{

Callers 1

slot_clearMarkMethod · 0.80

Calls 3

getDocTypePropertyFunction · 0.85
sizeMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected