Correct refactor issues with entry selection and search (#2518)

* Align entryview selection change signals with groupview
* Eliminate redundent and confusing signals/slots
* Correct group selection canceling search
This commit is contained in:
Jonathan White 2018-11-28 16:13:56 -05:00 committed by GitHub
parent fff0f11b33
commit d84ba23c81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 59 deletions

View file

@ -50,7 +50,7 @@ EntryView::EntryView(QWidget* parent)
setDefaultDropAction(Qt::MoveAction);
connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SLOT(emitEntrySelectionChanged()));
connect(m_model, SIGNAL(usernamesHiddenChanged()), SIGNAL(viewStateChanged()));
connect(m_model, SIGNAL(passwordsHiddenChanged()), SIGNAL(viewStateChanged()));
@ -144,13 +144,13 @@ void EntryView::keyPressEvent(QKeyEvent* event)
void EntryView::focusInEvent(QFocusEvent* event)
{
emit entrySelectionChanged();
emit entrySelectionChanged(currentEntry());
QTreeView::focusInEvent(event);
}
void EntryView::focusOutEvent(QFocusEvent* event)
{
emit entrySelectionChanged();
emit entrySelectionChanged(nullptr);
QTreeView::focusOutEvent(event);
}
@ -181,7 +181,7 @@ void EntryView::setFirstEntryActive()
QModelIndex index = m_sortModel->mapToSource(m_sortModel->index(0, 0));
setCurrentEntry(m_model->entryFromIndex(index));
} else {
emit entrySelectionChanged();
emit entrySelectionChanged(currentEntry());
}
}
@ -196,6 +196,11 @@ void EntryView::emitEntryActivated(const QModelIndex& index)
emit entryActivated(entry, static_cast<EntryModel::ModelColumn>(m_sortModel->mapToSource(index).column()));
}
void EntryView::emitEntrySelectionChanged()
{
emit entrySelectionChanged(currentEntry());
}
void EntryView::setModel(QAbstractItemModel* model)
{
Q_UNUSED(model);