MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / updateMessage

Method updateMessage

src/plugins/find/gui/searchresultwidget.cpp:113–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113void SearchResultWidgetPrivate::updateMessage()
114{
115 Q_EMIT q->resultCountChanged();
116 const auto &result = resultModel.allResult();
117 if (result.isEmpty()) {
118 msgLabel->clear();
119 return;
120 }
121
122 int totalResult = 0;
123 for (const auto &list : result) {
124 totalResult += list.size();
125 }
126
127 QString msg;
128 auto color = q->palette().color(QPalette::Highlight).name();
129 auto colorFormat = "<font color='" + color + "'>%1</font>";
130 if (result.count() == 1 && result.first().count() == 1) {
131 msg = SearchResultWidget::tr("%1 result in %2 file").arg(colorFormat.arg(1), colorFormat.arg(1));
132 } else if (result.count() == 1) {
133 msg = SearchResultWidget::tr("%1 results in %2 file").arg(colorFormat.arg(totalResult), colorFormat.arg(1));
134 } else {
135 msg = SearchResultWidget::tr("%1 results in %2 files").arg(colorFormat.arg(totalResult), colorFormat.arg(result.count()));
136 }
137
138 msgLabel->setText(msg);
139}
140
141void SearchResultWidgetPrivate::readyReplace(const QModelIndex &index)
142{

Callers

nothing calls this directly

Calls 8

allResultMethod · 0.45
isEmptyMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
nameMethod · 0.45
colorMethod · 0.45
countMethod · 0.45
setTextMethod · 0.45

Tested by

no test coverage detected