From aa5d2098d02076f3268d9cba27e6d27f822b975c Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Wed, 1 Dec 2021 00:46:02 +0100 Subject: Don't waste space for non existing subspaces --- src/timeline/CommunitiesModel.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/timeline/CommunitiesModel.h') diff --git a/src/timeline/CommunitiesModel.h b/src/timeline/CommunitiesModel.h index 21d24829..5191b239 100644 --- a/src/timeline/CommunitiesModel.h +++ b/src/timeline/CommunitiesModel.h @@ -33,6 +33,7 @@ class CommunitiesModel : public QAbstractListModel currentTagIdChanged RESET resetCurrentTagId) Q_PROPERTY(QStringList tags READ tags NOTIFY tagsChanged) Q_PROPERTY(QStringList tagsWithDefault READ tagsWithDefault NOTIFY tagsChanged) + Q_PROPERTY(bool containsSubspaces READ containsSubspaces NOTIFY containsSubspacesChanged) public: enum Roles @@ -103,6 +104,14 @@ public: QVariant data(const QModelIndex &index, int role) const override; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; + bool containsSubspaces() const + { + for (const auto &e : spaceOrder_.tree) + if (e.depth > 0) + return true; + return false; + } + public slots: void initializeSidebar(); void sync(const mtx::responses::Sync &sync_); @@ -131,6 +140,7 @@ signals: void currentTagIdChanged(QString tagId); void hiddenTagsChanged(); void tagsChanged(); + void containsSubspacesChanged(); private: QStringList tags_; -- cgit 1.5.1