mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Fix first entry is not selected when a search is performed (#9868)
This commit is contained in:
parent
6b67f587e5
commit
cd7a53abbb
@ -219,11 +219,12 @@ void EntryView::displaySearch(const QList<Entry*>& entries)
|
|||||||
m_model->setEntries(entries);
|
m_model->setEntries(entries);
|
||||||
header()->showSection(EntryModel::ParentGroup);
|
header()->showSection(EntryModel::ParentGroup);
|
||||||
|
|
||||||
|
setFirstEntryActive();
|
||||||
|
|
||||||
// Reset sort column to 'Group', overrides DatabaseWidgetStateSync
|
// Reset sort column to 'Group', overrides DatabaseWidgetStateSync
|
||||||
m_sortModel->sort(EntryModel::ParentGroup, Qt::AscendingOrder);
|
m_sortModel->sort(EntryModel::ParentGroup, Qt::AscendingOrder);
|
||||||
sortByColumn(EntryModel::ParentGroup, Qt::AscendingOrder);
|
sortByColumn(EntryModel::ParentGroup, Qt::AscendingOrder);
|
||||||
|
|
||||||
setFirstEntryActive();
|
|
||||||
m_inSearchMode = true;
|
m_inSearchMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1082,6 +1082,13 @@ void TestGui::testSearch()
|
|||||||
QCOMPARE(groupView->currentGroup(), m_db->rootGroup());
|
QCOMPARE(groupView->currentGroup(), m_db->rootGroup());
|
||||||
QVERIFY(!m_dbWidget->isSearchActive());
|
QVERIFY(!m_dbWidget->isSearchActive());
|
||||||
|
|
||||||
|
// check if first entry is selected after search
|
||||||
|
QTest::keyClicks(searchTextEdit, "some");
|
||||||
|
QTRY_VERIFY(m_dbWidget->isSearchActive());
|
||||||
|
QTRY_COMPARE(entryView->selectedEntries().length(), 1);
|
||||||
|
QModelIndex index_current = entryView->indexFromEntry(entryView->currentEntry());
|
||||||
|
QTRY_COMPARE(index_current.row(), 0);
|
||||||
|
|
||||||
// Try to edit the first entry from the search view
|
// Try to edit the first entry from the search view
|
||||||
// Refocus back to search edit
|
// Refocus back to search edit
|
||||||
QTest::mouseClick(searchTextEdit, Qt::LeftButton);
|
QTest::mouseClick(searchTextEdit, Qt::LeftButton);
|
||||||
|
Loading…
Reference in New Issue
Block a user