mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Select newly created groups and expand parent.
This commit is contained in:
parent
84a9e397d2
commit
554029ac31
@ -206,6 +206,8 @@ void DatabaseWidget::switchToView(bool accepted)
|
||||
if (m_newGroup) {
|
||||
if (accepted) {
|
||||
m_newGroup->setParent(m_newParent);
|
||||
m_groupView->setCurrentGroup(m_newGroup);
|
||||
m_groupView->expandGroup(m_newParent);
|
||||
}
|
||||
else {
|
||||
delete m_newGroup;
|
||||
|
@ -72,14 +72,19 @@ void GroupView::expandedChanged(const QModelIndex& index)
|
||||
|
||||
void GroupView::recInitExpanded(Group* group)
|
||||
{
|
||||
QModelIndex index = m_model->index(group);
|
||||
setExpanded(index, group->isExpanded());
|
||||
expandGroup(group, group->isExpanded());
|
||||
|
||||
Q_FOREACH (Group* child, group->children()) {
|
||||
recInitExpanded(child);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupView::expandGroup(Group* group, bool expand)
|
||||
{
|
||||
QModelIndex index = m_model->index(group);
|
||||
setExpanded(index, expand);
|
||||
}
|
||||
|
||||
void GroupView::emitGroupChanged(const QModelIndex& index)
|
||||
{
|
||||
Q_EMIT groupChanged(m_model->groupFromIndex(index));
|
||||
@ -95,3 +100,8 @@ void GroupView::emitGroupChanged()
|
||||
{
|
||||
Q_EMIT groupChanged(currentGroup());
|
||||
}
|
||||
|
||||
void GroupView::setCurrentGroup(Group* group)
|
||||
{
|
||||
setCurrentIndex(m_model->index(group));
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ public:
|
||||
explicit GroupView(Database* db, QWidget* parent = 0);
|
||||
void setModel(QAbstractItemModel* model);
|
||||
Group* currentGroup();
|
||||
void setCurrentGroup(Group* group);
|
||||
void expandGroup(Group* group, bool expand = true);
|
||||
|
||||
Q_SIGNALS:
|
||||
void groupChanged(Group* group);
|
||||
|
Loading…
Reference in New Issue
Block a user