mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2025-01-15 09:17:28 -05:00
Avoid multiple editFinished signals from group view.
This commit is contained in:
parent
a720903083
commit
e578ca9a82
@ -29,6 +29,7 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
|||||||
, m_model(new GroupModel(db, this))
|
, m_model(new GroupModel(db, this))
|
||||||
{
|
{
|
||||||
QTreeView::setModel(m_model);
|
QTreeView::setModel(m_model);
|
||||||
|
m_emitEditFinished = false;
|
||||||
setHeaderHidden(true);
|
setHeaderHidden(true);
|
||||||
setUniformRowHeights(true);
|
setUniformRowHeights(true);
|
||||||
|
|
||||||
@ -47,6 +48,7 @@ GroupView::GroupView(Database* db, QWidget* parent)
|
|||||||
setDragEnabled(true);
|
setDragEnabled(true);
|
||||||
viewport()->setAcceptDrops(true);
|
viewport()->setAcceptDrops(true);
|
||||||
setDropIndicatorShown(true);
|
setDropIndicatorShown(true);
|
||||||
|
m_emitEditFinished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupView::dragMoveEvent(QDragMoveEvent* event)
|
void GroupView::dragMoveEvent(QDragMoveEvent* event)
|
||||||
@ -74,7 +76,7 @@ void GroupView::expandedChanged(const QModelIndex& index)
|
|||||||
{
|
{
|
||||||
Group* group = m_model->groupFromIndex(index);
|
Group* group = m_model->groupFromIndex(index);
|
||||||
group->setExpanded(isExpanded(index));
|
group->setExpanded(isExpanded(index));
|
||||||
Q_EMIT editFinished();
|
emitEditFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupView::recInitExpanded(Group* group)
|
void GroupView::recInitExpanded(Group* group)
|
||||||
@ -86,6 +88,13 @@ void GroupView::recInitExpanded(Group* group)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GroupView::emitEditFinished()
|
||||||
|
{
|
||||||
|
if (m_emitEditFinished) {
|
||||||
|
Q_EMIT editFinished();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GroupView::expandGroup(Group* group, bool expand)
|
void GroupView::expandGroup(Group* group, bool expand)
|
||||||
{
|
{
|
||||||
QModelIndex index = m_model->index(group);
|
QModelIndex index = m_model->index(group);
|
||||||
@ -110,10 +119,13 @@ void GroupView::emitGroupChanged()
|
|||||||
|
|
||||||
void GroupView::syncExpandedState(const QModelIndex& parent, int start, int end)
|
void GroupView::syncExpandedState(const QModelIndex& parent, int start, int end)
|
||||||
{
|
{
|
||||||
|
m_emitEditFinished = false;
|
||||||
for (int row = start; row <= end; row++) {
|
for (int row = start; row <= end; row++) {
|
||||||
Group* group = m_model->groupFromIndex(m_model->index(row, 0, parent));
|
Group* group = m_model->groupFromIndex(m_model->index(row, 0, parent));
|
||||||
recInitExpanded(group);
|
recInitExpanded(group);
|
||||||
}
|
}
|
||||||
|
m_emitEditFinished = true;
|
||||||
|
emitEditFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupView::setCurrentGroup(Group* group)
|
void GroupView::setCurrentGroup(Group* group)
|
||||||
|
@ -50,8 +50,10 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void recInitExpanded(Group* group);
|
void recInitExpanded(Group* group);
|
||||||
|
void emitEditFinished();
|
||||||
|
|
||||||
GroupModel* const m_model;
|
GroupModel* const m_model;
|
||||||
|
bool m_emitEditFinished;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // KEEPASSX_GROUPVIEW_H
|
#endif // KEEPASSX_GROUPVIEW_H
|
||||||
|
Loading…
Reference in New Issue
Block a user