fixed comment count in channels

This commit is contained in:
csoler 2020-11-08 15:49:00 +01:00
parent 0a6e15c524
commit 542650a919

View file

@ -669,23 +669,20 @@ void GxsCommentTreeWidget::addItem(RsGxsMessageId itemId, RsGxsMessageId parentI
int treeCount(QTreeWidget *tree, QTreeWidgetItem *parent = 0) int treeCount(QTreeWidget *tree, QTreeWidgetItem *parent = 0)
{ {
int count = 0; int count = 0;
if (parent == 0) { if (parent == 0)
{
int topCount = tree->topLevelItemCount(); int topCount = tree->topLevelItemCount();
for (int i = 0; i < topCount; i++) { for (int i = 0; i < topCount; i++)
QTreeWidgetItem *item = tree->topLevelItem(i); count += treeCount(tree, tree->topLevelItem(i));
if (item->isExpanded()) {
count += treeCount(tree, item);
}
}
count += topCount; count += topCount;
} else { }
else
{
int childCount = parent->childCount(); int childCount = parent->childCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++)
QTreeWidgetItem *item = parent->child(i); count += treeCount(tree, parent->child(i));
if (item->isExpanded()) {
count += treeCount(tree, item);
}
}
count += childCount; count += childCount;
} }
return count; return count;