Skip to content

Commit fd49d2a

Browse files
committed
fix: replaced bubble timeTip display error
as title Log: as title
1 parent 1d3d3c7 commit fd49d2a

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

panels/notification/bubble/bubblemodel.cpp

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,6 @@ void BubbleModel::push(BubbleItem *bubble)
5555
m_bubbles.prepend(bubble);
5656
endInsertRows();
5757

58-
connect(bubble, &BubbleItem::timeTipChanged, this, [this, bubble] {
59-
const auto row = m_bubbles.indexOf(bubble);
60-
if (row <= displayRowCount()) {
61-
Q_EMIT dataChanged(index(row), index(row), {BubbleModel::TimeTip});
62-
}
63-
});
64-
6558
updateLevel();
6659
}
6760

@@ -313,19 +306,20 @@ void BubbleModel::updateBubbleTimeTip()
313306
{
314307
if (m_bubbles.isEmpty()) {
315308
m_updateTimeTipTimer->stop();
309+
return;
316310
}
317311

318-
for (int i = 0; i < displayRowCount(); i++) {
319-
auto item = m_bubbles.at(i);
320-
312+
for (auto item : m_bubbles) {
321313
qint64 diff = QDateTime::currentMSecsSinceEpoch() - item->ctime();
322314
diff /= 1000; // secs
323-
QString timeTip;
324315
if (diff >= 60) {
316+
QString timeTip;
325317
timeTip = tr("%1 minutes ago").arg(diff / 60);
326318
item->setTimeTip(timeTip);
327319
};
328320
}
321+
322+
Q_EMIT dataChanged(index(0), index(m_bubbles.size() - 1), {BubbleModel::TimeTip});
329323
}
330324

331325
void BubbleModel::updateContentRowCount(int rowCount)

0 commit comments

Comments
 (0)