mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Sync expanded state to the view for new groups.
This commit is contained in:
parent
1ea14e1090
commit
eb430d78a0
@ -38,6 +38,7 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
||||
recInitExpanded(db->rootGroup());
|
||||
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
|
||||
connect(this, SIGNAL(collapsed(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
|
||||
connect(m_model, SIGNAL(rowsInserted(QModelIndex,int,int)), SLOT(syncExpandedState(QModelIndex,int,int)));
|
||||
|
||||
setCurrentIndex(m_model->index(0, 0));
|
||||
// invoke later so the EntryView is connected
|
||||
@ -102,6 +103,14 @@ void GroupView::emitGroupChanged()
|
||||
Q_EMIT groupChanged(currentGroup());
|
||||
}
|
||||
|
||||
void GroupView::syncExpandedState(const QModelIndex& parent, int start, int end)
|
||||
{
|
||||
for (int row = start; row <= end; row++) {
|
||||
Group* group = m_model->groupFromIndex(m_model->index(row, 0, parent));
|
||||
recInitExpanded(group);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupView::setCurrentGroup(Group* group)
|
||||
{
|
||||
setCurrentIndex(m_model->index(group));
|
||||
|
@ -42,6 +42,7 @@ private Q_SLOTS:
|
||||
void expandedChanged(const QModelIndex& index);
|
||||
void emitGroupChanged(const QModelIndex& index);
|
||||
void emitGroupChanged();
|
||||
void syncExpandedState(const QModelIndex& parent, int start, int end);
|
||||
|
||||
protected:
|
||||
void dragMoveEvent(QDragMoveEvent* event);
|
||||
|
Loading…
Reference in New Issue
Block a user