CNodeSelection: Make use of QSignalBlocker
This commit is contained in:
parent
207a378c79
commit
978627d14e
|
@ -6,6 +6,7 @@
|
||||||
#include <Core/Scene/CScriptNode.h>
|
#include <Core/Scene/CScriptNode.h>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QSignalBlocker>
|
||||||
|
|
||||||
class CNodeSelection : public QObject
|
class CNodeSelection : public QObject
|
||||||
{
|
{
|
||||||
|
@ -61,20 +62,23 @@ public:
|
||||||
void ClearAndSelectNode(CSceneNode *pNode)
|
void ClearAndSelectNode(CSceneNode *pNode)
|
||||||
{
|
{
|
||||||
// Block signals for Clear so that Modified only emits once.
|
// Block signals for Clear so that Modified only emits once.
|
||||||
blockSignals(true);
|
{
|
||||||
|
[[maybe_unused]] const QSignalBlocker blocker{this};
|
||||||
Clear();
|
Clear();
|
||||||
blockSignals(false);
|
}
|
||||||
|
|
||||||
SelectNode(pNode);
|
SelectNode(pNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSelectedNodes(const QList<CSceneNode*>& rkList)
|
void SetSelectedNodes(const QList<CSceneNode*>& rkList)
|
||||||
{
|
{
|
||||||
blockSignals(true);
|
{
|
||||||
|
[[maybe_unused]] const QSignalBlocker blocker{this};
|
||||||
Clear();
|
Clear();
|
||||||
|
|
||||||
for (CSceneNode* pNode : rkList)
|
for (CSceneNode* pNode : rkList)
|
||||||
SelectNode(pNode);
|
SelectNode(pNode);
|
||||||
blockSignals(false);
|
}
|
||||||
|
|
||||||
mBoundsDirty = true;
|
mBoundsDirty = true;
|
||||||
emit Modified();
|
emit Modified();
|
||||||
|
|
Loading…
Reference in New Issue