forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QScopeGuard>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include <nodemetainfo.h>
|
#include <nodemetainfo.h>
|
||||||
|
|
||||||
@@ -279,8 +279,8 @@ void StatesEditorView::setWhenCondition(int internalNodeId, const QString &condi
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_block = true;
|
m_block = true;
|
||||||
auto guard = [this]() { m_block = false; };
|
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||||
QScopeGuard<decltype(guard)> lock(guard);
|
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||||
|
|
||||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
@@ -300,8 +300,8 @@ void StatesEditorView::resetWhenCondition(int internalNodeId)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_block = true;
|
m_block = true;
|
||||||
auto guard = [this]() { m_block = false; };
|
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||||
QScopeGuard<decltype(guard)> lock(guard);
|
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||||
|
|
||||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
@@ -321,8 +321,8 @@ void StatesEditorView::setStateAsDefault(int internalNodeId)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_block = true;
|
m_block = true;
|
||||||
auto guard = [this]() { m_block = false; };
|
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||||
QScopeGuard<decltype(guard)> lock(guard);
|
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||||
|
|
||||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
@@ -342,8 +342,8 @@ void StatesEditorView::resetDefaultState()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_block = true;
|
m_block = true;
|
||||||
auto guard = [this]() { m_block = false; };
|
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||||
QScopeGuard<decltype(guard)> lock(guard);
|
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (rootModelNode().hasProperty("state"))
|
if (rootModelNode().hasProperty("state"))
|
||||||
@@ -365,8 +365,8 @@ void StatesEditorView::setAnnotation(int internalNodeId)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_block = true;
|
m_block = true;
|
||||||
auto guard = [this]() { m_block = false; };
|
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||||
QScopeGuard<decltype(guard)> lock(guard);
|
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||||
|
|
||||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
@@ -395,8 +395,8 @@ void StatesEditorView::removeAnnotation(int internalNodeId)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_block = true;
|
m_block = true;
|
||||||
auto guard = [this]() { m_block = false; };
|
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||||
QScopeGuard<decltype(guard)> lock(guard);
|
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||||
|
|
||||||
if (hasModelNodeForInternalId(internalNodeId)) {
|
if (hasModelNodeForInternalId(internalNodeId)) {
|
||||||
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
QmlModelState state(modelNodeForInternalId(internalNodeId));
|
||||||
@@ -517,8 +517,8 @@ void StatesEditorView::variantPropertiesChanged(const QList<VariantProperty> &pr
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_block = true;
|
m_block = true;
|
||||||
auto guard = [this]() { m_block = false; };
|
auto guard = [this](int* p) { m_block = false; delete p; };
|
||||||
QScopeGuard<decltype(guard)> lock(guard);
|
std::unique_ptr<int, decltype(guard)> scopeGuard(new int, guard);
|
||||||
|
|
||||||
for (const VariantProperty &property : propertyList) {
|
for (const VariantProperty &property : propertyList) {
|
||||||
if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode()))
|
if (property.name() == "name" && QmlModelState::isValidQmlModelState(property.parentModelNode()))
|
||||||
|
Reference in New Issue
Block a user