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);
{
[[maybe_unused]] const QSignalBlocker blocker{this};
Clear();
blockSignals(false);
}
SelectNode(pNode);
}
void SetSelectedNodes(const QList<CSceneNode*>& rkList)
{
blockSignals(true);
{
[[maybe_unused]] const QSignalBlocker blocker{this};
Clear();
for (CSceneNode *pNode : rkList)
for (CSceneNode* pNode : rkList)
SelectNode(pNode);
blockSignals(false);
}
mBoundsDirty = true;
emit Modified();