Skip to content

Commit

Permalink
Use NamedBool<> in AttributeChangesTracker
Browse files Browse the repository at this point in the history
  • Loading branch information
timangus committed Jun 5, 2024
1 parent 56cc1e6 commit b284e2c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion source/app/graph/graphmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1548,7 +1548,8 @@ void GraphModel::onAttributesChanged(const QStringList& addedNames, const QStrin
emit rebuildRequired(transformRebuildRequired, visualisationRebuildRequired);
}

AttributeChangesTracker::AttributeChangesTracker(GraphModel* graphModel, bool emitOnDestruct) :
AttributeChangesTracker::AttributeChangesTracker(GraphModel* graphModel,
NamedBool<"emitOnDestruct"> emitOnDestruct) :
_graphModel(graphModel), _emitOnDestruct(emitOnDestruct)
{
_graphModel->_->_attributeChangesTrackers.insert(this);
Expand Down
5 changes: 4 additions & 1 deletion source/app/graph/graphmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@

#include "shared/loading/userelementdata.h"

#include "shared/utils/namedbool.h"

#include "app/preferences.h"

#include "app/attributes/attribute.h"
Expand Down Expand Up @@ -233,7 +235,8 @@ class AttributeChangesTracker
void change(const QString& name);

public:
explicit AttributeChangesTracker(GraphModel* graphModel, bool emitOnDestruct = true);
explicit AttributeChangesTracker(GraphModel* graphModel,
NamedBool<"emitOnDestruct"> emitOnDestruct = "emitOnDestruct"_yes);
~AttributeChangesTracker();

QStringList added() const { return {_added.begin(), _added.end()}; }
Expand Down
2 changes: 1 addition & 1 deletion source/app/transform/transformedgraph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void TransformedGraph::rebuild()
continue;
}

const AttributeChangesTracker tracker(_graphModel, false);
const AttributeChangesTracker tracker(_graphModel, "emitOnDestruct"_no);

setCurrentTransform(transform.get());
transform->uncancel();
Expand Down

0 comments on commit b284e2c

Please sign in to comment.