mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-09-20 08:05:40 +00: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());
|
recInitExpanded(db->rootGroup());
|
||||||
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
|
connect(this, SIGNAL(expanded(QModelIndex)), this, SLOT(expandedChanged(QModelIndex)));
|
||||||
connect(this, SIGNAL(collapsed(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));
|
setCurrentIndex(m_model->index(0, 0));
|
||||||
// invoke later so the EntryView is connected
|
// invoke later so the EntryView is connected
|
||||||
@ -102,6 +103,14 @@ void GroupView::emitGroupChanged()
|
|||||||
Q_EMIT groupChanged(currentGroup());
|
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)
|
void GroupView::setCurrentGroup(Group* group)
|
||||||
{
|
{
|
||||||
setCurrentIndex(m_model->index(group));
|
setCurrentIndex(m_model->index(group));
|
||||||
|
@ -42,6 +42,7 @@ private Q_SLOTS:
|
|||||||
void expandedChanged(const QModelIndex& index);
|
void expandedChanged(const QModelIndex& index);
|
||||||
void emitGroupChanged(const QModelIndex& index);
|
void emitGroupChanged(const QModelIndex& index);
|
||||||
void emitGroupChanged();
|
void emitGroupChanged();
|
||||||
|
void syncExpandedState(const QModelIndex& parent, int start, int end);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void dragMoveEvent(QDragMoveEvent* event);
|
void dragMoveEvent(QDragMoveEvent* event);
|
||||||
|
Loading…
Reference in New Issue
Block a user