forked from qt-creator/qt-creator
StatesEditorView: replace custom scope guard with qScopeGuard
Change-Id: I87379e50fb652ed27692f78470d9bf706d5abfe8 Reviewed-by: Aleksei German <aleksei.german@qt.io> Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -317,8 +317,7 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi
|
||||
return;
|
||||
|
||||
m_block = true;
|
||||
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||
auto guard = qScopeGuard([&]() { m_block = false; });
|
||||
|
||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||
@@ -338,8 +337,7 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
|
||||
return;
|
||||
|
||||
m_block = true;
|
||||
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||
auto guard = qScopeGuard([&]() { m_block = false; });
|
||||
|
||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||
@@ -359,8 +357,7 @@ void StatesEditorView::setStateAsDefault(int internalNodeId)
|
||||
return;
|
||||
|
||||
m_block = true;
|
||||
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||
auto guard = qScopeGuard([&]() { m_block = false; });
|
||||
|
||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||
@@ -380,8 +377,7 @@ void StatesEditorView::resetDefaultState()
|
||||
return;
|
||||
|
||||
m_block = true;
|
||||
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||
auto guard = qScopeGuard([&]() { m_block = false; });
|
||||
|
||||
try {
|
||||
if (rootModelNode().hasProperty("state"))
|
||||
@@ -403,8 +399,7 @@ void StatesEditorView::setAnnotation(int internalNodeId)
|
||||
return;
|
||||
|
||||
m_block = true;
|
||||
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||
auto guard = qScopeGuard([&]() { m_block = false; });
|
||||
|
||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||
@@ -433,8 +428,7 @@ void StatesEditorView::removeAnnotation(int internalNodeId)
|
||||
return;
|
||||
|
||||
m_block = true;
|
||||
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||
auto guard = qScopeGuard([&]() { m_block = false; });
|
||||
|
||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||
@@ -555,8 +549,7 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
|
||||
return;
|
||||
|
||||
m_block = true;
|
||||
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||
auto guard = qScopeGuard([&]() { m_block = false; });
|
||||
|
||||
for (const VariantProperty &property : propertyList) {
|
||||
if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode()))
|
||||
|
||||
Reference in New Issue
Block a user