From a65af0dd22b854a7f69ae7ec63070d75d2da8c6b Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 10 Jul 2020 10:57:21 -0400 Subject: [PATCH] CVirtualDirectoryTreeView: Make use of QSignalBlocker() Same behavior, but automatically releases blocked signals. --- src/Editor/ResourceBrowser/CVirtualDirectoryTreeView.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Editor/ResourceBrowser/CVirtualDirectoryTreeView.cpp b/src/Editor/ResourceBrowser/CVirtualDirectoryTreeView.cpp index e520e361..87586edf 100644 --- a/src/Editor/ResourceBrowser/CVirtualDirectoryTreeView.cpp +++ b/src/Editor/ResourceBrowser/CVirtualDirectoryTreeView.cpp @@ -68,10 +68,11 @@ void CVirtualDirectoryTreeView::OnDirectoryMoved(const CVirtualDirectory *pDir) const QModelIndex Index = mpModel->GetIndexForDirectory(pDir); - blockSignals(true); - expand(Index.parent()); - selectionModel()->setCurrentIndex(Index, QItemSelectionModel::ClearAndSelect); - blockSignals(false); + { + [[maybe_unused]] const QSignalBlocker blocker{this}; + expand(Index.parent()); + selectionModel()->setCurrentIndex(Index, QItemSelectionModel::ClearAndSelect); + } mTransferSelectionPostMove = false; }