CNodeSelection: Make use of QSignalBlocker

This commit is contained in:
Lioncash 2020-07-10 15:37:35 -04:00
parent 207a378c79
commit 978627d14e
1 changed files with 12 additions and 8 deletions

View File

@ -6,6 +6,7 @@
#include <Core/Scene/CScriptNode.h>
#include <QList>
#include <QObject>
#include <QSignalBlocker>
class CNodeSelection : public QObject
{
@ -61,20 +62,23 @@ public:
void ClearAndSelectNode(CSceneNode *pNode)
{
// Block signals for Clear so that Modified only emits once.
blockSignals(true);
Clear();
blockSignals(false);
{
[[maybe_unused]] const QSignalBlocker blocker{this};
Clear();
}
SelectNode(pNode);
}
void SetSelectedNodes(const QList<CSceneNode*>& rkList)
{
blockSignals(true);
Clear();
{
[[maybe_unused]] const QSignalBlocker blocker{this};
Clear();
for (CSceneNode *pNode : rkList)
SelectNode(pNode);
blockSignals(false);
for (CSceneNode* pNode : rkList)
SelectNode(pNode);
}
mBoundsDirty = true;
emit Modified();