UI: Remove SignalBlocker
Since QSignalBlocker does the same thing, remove SignalBlocker.
This commit is contained in:
parent
ea9df85512
commit
59766ee4ff
@ -86,19 +86,6 @@ void EnableThreadedMessageBoxes(bool enable);
|
|||||||
void ExecThreadedWithoutBlocking(std::function<void()> func,
|
void ExecThreadedWithoutBlocking(std::function<void()> func,
|
||||||
const QString &title, const QString &text);
|
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);
|
void DeleteLayout(QLayout *layout);
|
||||||
|
|
||||||
static inline Qt::ConnectionType WaitConnection()
|
static inline Qt::ConnectionType WaitConnection()
|
||||||
|
@ -157,12 +157,12 @@ SourceTreeItem::SourceTreeItem(SourceTree *tree_, OBSSceneItem sceneitem_)
|
|||||||
std::bind(undo_redo, std::placeholders::_1, id, val),
|
std::bind(undo_redo, std::placeholders::_1, id, val),
|
||||||
uuid, uuid);
|
uuid, uuid);
|
||||||
|
|
||||||
SignalBlocker sourcesSignalBlocker(this);
|
QSignalBlocker sourcesSignalBlocker(this);
|
||||||
obs_sceneitem_set_visible(sceneitem, val);
|
obs_sceneitem_set_visible(sceneitem, val);
|
||||||
};
|
};
|
||||||
|
|
||||||
auto setItemLocked = [this](bool checked) {
|
auto setItemLocked = [this](bool checked) {
|
||||||
SignalBlocker sourcesSignalBlocker(this);
|
QSignalBlocker sourcesSignalBlocker(this);
|
||||||
obs_sceneitem_set_locked(sceneitem, checked);
|
obs_sceneitem_set_locked(sceneitem, checked);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -447,7 +447,7 @@ void SourceTreeItem::ExitEditModeInternal(bool save)
|
|||||||
/* ----------------------------------------- */
|
/* ----------------------------------------- */
|
||||||
/* rename */
|
/* rename */
|
||||||
|
|
||||||
SignalBlocker sourcesSignalBlocker(this);
|
QSignalBlocker sourcesSignalBlocker(this);
|
||||||
std::string prevName(obs_source_get_name(source));
|
std::string prevName(obs_source_get_name(source));
|
||||||
std::string scene_uuid =
|
std::string scene_uuid =
|
||||||
obs_source_get_uuid(main->GetCurrentSceneSource());
|
obs_source_get_uuid(main->GetCurrentSceneSource());
|
||||||
@ -1485,7 +1485,7 @@ void SourceTree::selectionChanged(const QItemSelection &selected,
|
|||||||
const QItemSelection &deselected)
|
const QItemSelection &deselected)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
SignalBlocker sourcesSignalBlocker(this);
|
QSignalBlocker sourcesSignalBlocker(this);
|
||||||
SourceTreeModel *stm = GetStm();
|
SourceTreeModel *stm = GetStm();
|
||||||
|
|
||||||
QModelIndexList selectedIdxs = selected.indexes();
|
QModelIndexList selectedIdxs = selected.indexes();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user