From 59766ee4ff3da8ae7d0b0f4ba878f771194ba162 Mon Sep 17 00:00:00 2001 From: cg2121 Date: Mon, 11 Dec 2023 22:47:38 -0600 Subject: [PATCH] UI: Remove SignalBlocker Since QSignalBlocker does the same thing, remove SignalBlocker. --- UI/qt-wrappers.hpp | 13 ------------- UI/source-tree.cpp | 8 ++++---- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/UI/qt-wrappers.hpp b/UI/qt-wrappers.hpp index 863ead68c..4a45ebfc9 100644 --- a/UI/qt-wrappers.hpp +++ b/UI/qt-wrappers.hpp @@ -86,19 +86,6 @@ void EnableThreadedMessageBoxes(bool enable); void ExecThreadedWithoutBlocking(std::function func, const QString &title, const QString &text); -class SignalBlocker { - QWidget *widget; - bool blocked; - -public: - inline explicit SignalBlocker(QWidget *widget_) : widget(widget_) - { - blocked = widget->blockSignals(true); - } - - inline ~SignalBlocker() { widget->blockSignals(blocked); } -}; - void DeleteLayout(QLayout *layout); static inline Qt::ConnectionType WaitConnection() diff --git a/UI/source-tree.cpp b/UI/source-tree.cpp index 66f44da71..1f6d146df 100644 --- a/UI/source-tree.cpp +++ b/UI/source-tree.cpp @@ -157,12 +157,12 @@ SourceTreeItem::SourceTreeItem(SourceTree *tree_, OBSSceneItem sceneitem_) std::bind(undo_redo, std::placeholders::_1, id, val), uuid, uuid); - SignalBlocker sourcesSignalBlocker(this); + QSignalBlocker sourcesSignalBlocker(this); obs_sceneitem_set_visible(sceneitem, val); }; auto setItemLocked = [this](bool checked) { - SignalBlocker sourcesSignalBlocker(this); + QSignalBlocker sourcesSignalBlocker(this); obs_sceneitem_set_locked(sceneitem, checked); }; @@ -447,7 +447,7 @@ void SourceTreeItem::ExitEditModeInternal(bool save) /* ----------------------------------------- */ /* rename */ - SignalBlocker sourcesSignalBlocker(this); + QSignalBlocker sourcesSignalBlocker(this); std::string prevName(obs_source_get_name(source)); std::string scene_uuid = obs_source_get_uuid(main->GetCurrentSceneSource()); @@ -1485,7 +1485,7 @@ void SourceTree::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) { { - SignalBlocker sourcesSignalBlocker(this); + QSignalBlocker sourcesSignalBlocker(this); SourceTreeModel *stm = GetStm(); QModelIndexList selectedIdxs = selected.indexes();