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

Method on_replaceBtClick

src/batchfindreplace.cpp:201–236  ·  view source on GitHub ↗

���������滻����

Source from the content-addressed store, hash-verified

199
200//���������滻����
201void BatchFindReplace::on_replaceBtClick()
202{
203 if (m_mainNotepad != nullptr)
204 {
205 int rowNums = ui.findReplaceTable->rowCount();
206 if (rowNums == 0)
207 {
208 CTipWin::showTips(this, tr("Please fresh first !"), 1200);
209 return;
210 }
211
212
213 QStringList findKeyList;
214 QStringList replaceKeyList;
215
216 for (int i = 0; i < rowNums; ++i)
217 {
218 QTableWidgetItem* item = ui.findReplaceTable->item(i, 0);
219 if (item != nullptr && !item->text().isEmpty())
220 {
221 QTableWidgetItem* replaceItem = ui.findReplaceTable->item(i, 1);
222 if (replaceItem != nullptr)
223 {
224 if (item->text() != replaceItem->text())
225 {
226 findKeyList.append(item->text());
227 replaceKeyList.append(replaceItem->text());
228 }
229 }
230 }
231 }
232 m_mainNotepad->replaceAtBack(findKeyList, replaceKeyList);
233
234 ui.statusBar->showMessage(tr("Batch Replace Finished, total Replace %1 times !").arg(findKeyList.size()), 10000);
235 }
236}
237
238void BatchFindReplace::on_swapFindReplace()
239{

Callers

nothing calls this directly

Calls 5

isEmptyMethod · 0.80
appendMethod · 0.80
textMethod · 0.45
replaceAtBackMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected