mirror of
https://github.com/zealdocs/zeal.git
synced 2024-11-22 21:53:03 +03:00
fix(ui): fix crash on tab duplication
The crash occurred when there were selected items in the tree view.
This commit is contained in:
parent
803db6ae34
commit
5220b7093e
@ -148,10 +148,15 @@ SearchSidebar::SearchSidebar(const SearchSidebar *other, QWidget *parent)
|
||||
setTreeViewModel(m_searchModel, false);
|
||||
}
|
||||
|
||||
// Clone current selection. Signals must be disabled to avoid crash in the event handler.
|
||||
m_treeView->selectionModel()->blockSignals(true);
|
||||
|
||||
for (const QModelIndex &index : other->m_treeView->selectionModel()->selectedIndexes()) {
|
||||
m_treeView->selectionModel()->select(index, QItemSelectionModel::Select);
|
||||
}
|
||||
|
||||
m_treeView->selectionModel()->blockSignals(false);
|
||||
|
||||
// Cannot update position until layout geomentry is calculated, so set it in showEvent().
|
||||
m_pendingVerticalPosition = other->m_treeView->verticalScrollBar()->value();
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user