aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksei German <aleksei.german@qt.io>2020-08-27 18:50:36 +0200
committerAleksei German <aleksei.german@qt.io>2020-08-28 06:48:12 +0000
commitae0b98a32a37a2ab0213e42e2de0652d77900310 (patch)
tree83dafd766d5fffa31d82bc8f85c3d8c3f68772a4
parent61b21b0a2fa91d8146c1b68a267608159727e2b6 (diff)
QmlDesigner: Fix for States compilation break
Fixing compilation break in StatesEditorView: QtCreator is build with 5.12 QScopeGuard is from 5.14+ Replaced scope guard with unique_ptr original task: QDS-2312 Change-Id: Id6a4bf513f37675044b073be2dfe52e3fa9dc3bc Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
index 78ac9da230..a74b86b828 100644
--- a/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
+++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorview.cpp
@@ -30,8 +30,8 @@
#include <QDebug>
#include <QRegExp>
-#include <QScopeGuard>
#include <cmath>
+#include <memory>
#include <nodemetainfo.h>
@@ -279,8 +279,8 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi
return;
m_block = true;
- auto guard = [this]() { m_block = false; };
- QScopeGuard<decltype(guard)> lock(guard);
+ auto guard = [this](int* p) { m_block = false; delete p; };
+ std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -300,8 +300,8 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
return;
m_block = true;
- auto guard = [this]() { m_block = false; };
- QScopeGuard<decltype(guard)> lock(guard);
+ auto guard = [this](int* p) { m_block = false; delete p; };
+ std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -321,8 +321,8 @@ void StatesEditorView::setStateAsDefault(int internalNodeId)
return;
m_block = true;
- auto guard = [this]() { m_block = false; };
- QScopeGuard<decltype(guard)> lock(guard);
+ auto guard = [this](int* p) { m_block = false; delete p; };
+ std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -342,8 +342,8 @@ void StatesEditorView::resetDefaultState()
return;
m_block = true;
- auto guard = [this]() { m_block = false; };
- QScopeGuard<decltype(guard)> lock(guard);
+ auto guard = [this](int* p) { m_block = false; delete p; };
+ std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
try {
if (rootModelNode().hasProperty("state"))
@@ -365,8 +365,8 @@ void StatesEditorView::setAnnotation(int internalNodeId)
return;
m_block = true;
- auto guard = [this]() { m_block = false; };
- QScopeGuard<decltype(guard)> lock(guard);
+ auto guard = [this](int* p) { m_block = false; delete p; };
+ std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -395,8 +395,8 @@ void StatesEditorView::removeAnnotation(int internalNodeId)
return;
m_block = true;
- auto guard = [this]() { m_block = false; };
- QScopeGuard<decltype(guard)> lock(guard);
+ auto guard = [this](int* p) { m_block = false; delete p; };
+ std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
if (hasModelNodeForInternalId(internalNodeId)) {
QmlModelState state(modelNodeForInternalId(internalNodeId));
@@ -517,8 +517,8 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
return;
m_block = true;
- auto guard = [this]() { m_block = false; };
- QScopeGuard<decltype(guard)> lock(guard);
+ auto guard = [this](int* p) { m_block = false; delete p; };
+ std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
for (const VariantProperty &property : propertyList) {
if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode()))