mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-26 04:58:49 +03:00
Don't waste space for non existing subspaces
This commit is contained in:
parent
fee2f5c701
commit
aa5d2098d0
3 changed files with 12 additions and 1 deletions
|
@ -131,7 +131,7 @@ Page {
|
|||
|
||||
Item {
|
||||
Layout.preferredWidth: fontMetrics.lineSpacing
|
||||
visible: !communitySidebar.collapsed && !model.collapsible
|
||||
visible: !communitySidebar.collapsed && !model.collapsible && Communities.containsSubspaces
|
||||
}
|
||||
|
||||
Avatar {
|
||||
|
|
|
@ -280,6 +280,7 @@ CommunitiesModel::initializeSidebar()
|
|||
|
||||
emit tagsChanged();
|
||||
emit hiddenTagsChanged();
|
||||
emit containsSubspacesChanged();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -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_;
|
||||
|
|
Loading…
Reference in a new issue