From 65152252a4b4c0c40b6c8da6f2819b130ec72166 Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 1 Dec 2021 00:24:57 +0100 Subject: [PATCH] Leaves can't collapse --- resources/qml/CommunitiesList.qml | 4 ++-- src/timeline/CommunitiesModel.cpp | 1 - src/timeline/CommunitiesModel.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/resources/qml/CommunitiesList.qml b/resources/qml/CommunitiesList.qml index fab3316e..8907a360 100644 --- a/resources/qml/CommunitiesList.qml +++ b/resources/qml/CommunitiesList.qml @@ -112,7 +112,7 @@ Page { spacing: Nheko.paddingMedium anchors.fill: parent anchors.margins: Nheko.paddingMedium - anchors.leftMargin: communitySidebar.collapsed ? Nheko.paddingMedium : (Nheko.paddingMedium * (model.depth + 1)) + anchors.leftMargin: Nheko.paddingMedium + (communitySidebar.collapsed ? 0 : (fontMetrics.lineSpacing * model.depth)) ImageButton { visible: !communitySidebar.collapsed && model.collapsible @@ -156,7 +156,7 @@ Page { visible: !communitySidebar.collapsed Layout.alignment: Qt.AlignVCenter color: communityItem.importantText - elideWidth: parent.width - avatar.width - r.anchors.leftMargin - Nheko.paddingMedium - fontMetrics.lineSpacing + elideWidth: parent.width - avatar.width - r.anchors.leftMargin/2 - Nheko.paddingMedium - fontMetrics.lineSpacing fullText: model.displayName textFormat: Text.PlainText } diff --git a/src/timeline/CommunitiesModel.cpp b/src/timeline/CommunitiesModel.cpp index 7b323bb9..0db3b0b0 100644 --- a/src/timeline/CommunitiesModel.cpp +++ b/src/timeline/CommunitiesModel.cpp @@ -438,7 +438,6 @@ tagIdToCat(QString tagId) bool FilteredCommunitiesModel::lessThan(const QModelIndex &left, const QModelIndex &right) const { - nhlog::ui()->debug("lessThan"); QModelIndex const left_idx = sourceModel()->index(left.row(), 0, QModelIndex()); QModelIndex const right_idx = sourceModel()->index(right.row(), 0, QModelIndex()); diff --git a/src/timeline/CommunitiesModel.h b/src/timeline/CommunitiesModel.h index 79f8c33a..21d24829 100644 --- a/src/timeline/CommunitiesModel.h +++ b/src/timeline/CommunitiesModel.h @@ -74,7 +74,7 @@ public: const auto depth = tree[index].depth; int i = index + 1; for (; i < size(); i++) - if (tree[i].depth == depth) + if (tree[i].depth <= depth) break; return i - 1; }