aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorMichael Winkelmann <michael.winkelmann@qt.io>2020-08-18 13:13:19 +0200
committerMichael Winkelmann <michael.winkelmann@qt.io>2020-08-18 13:25:59 +0000
commit888cbe7f8a0a55cbef3f5b73c60dff6ed71ed084 (patch)
treed17a8cd9a4f5521b0fa2008d897041fdd2098f2e /share
parentf830a21bf86607af700872e30be301b5e855d619 (diff)
QmlPuppet: Refactor ChangeAuxiliaryCommand
Change-Id: I32eb04db96322883aa908e22724756f5e25ded09 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'share')
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.cpp30
-rw-r--r--share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.h30
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp2
-rw-r--r--share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp2
4 files changed, 20 insertions, 44 deletions
diff --git a/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.cpp b/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.cpp
index 7f67b2112d..1f49501eab 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.cpp
+++ b/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -29,35 +29,9 @@
namespace QmlDesigner {
-ChangeAuxiliaryCommand::ChangeAuxiliaryCommand() = default;
-
-ChangeAuxiliaryCommand::ChangeAuxiliaryCommand(const QVector<PropertyValueContainer> &auxiliaryChangeVector)
- : m_auxiliaryChangeVector (auxiliaryChangeVector)
-{
-}
-
-QVector<PropertyValueContainer> ChangeAuxiliaryCommand::auxiliaryChanges() const
-{
- return m_auxiliaryChangeVector;
-}
-
-QDataStream &operator<<(QDataStream &out, const ChangeAuxiliaryCommand &command)
-{
- out << command.auxiliaryChanges();
-
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, ChangeAuxiliaryCommand &command)
-{
- in >> command.m_auxiliaryChangeVector;
-
- return in;
-}
-
QDebug operator <<(QDebug debug, const ChangeAuxiliaryCommand &command)
{
- return debug.nospace() << "ChangeAuxiliaryCommand(auxiliaryChanges: " << command.m_auxiliaryChangeVector << ")";
+ return debug.nospace() << "ChangeAuxiliaryCommand(auxiliaryChanges: " << command.auxiliaryChanges << ")";
}
} // namespace QmlDesigner
diff --git a/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.h b/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.h
index 669a747be8..675e18e26c 100644
--- a/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.h
+++ b/share/qtcreator/qml/qmlpuppet/commands/changeauxiliarycommand.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2020 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
@@ -25,6 +25,8 @@
#pragma once
+#include <QDataStream>
+#include <QDebug>
#include <QMetaType>
#include <QVector>
@@ -34,24 +36,24 @@ namespace QmlDesigner {
class ChangeAuxiliaryCommand
{
- friend QDataStream &operator>>(QDataStream &in, ChangeAuxiliaryCommand &command);
- friend QDebug operator <<(QDebug debug, const ChangeAuxiliaryCommand &command);
-
public:
- ChangeAuxiliaryCommand();
- explicit ChangeAuxiliaryCommand(const QVector<PropertyValueContainer> &auxiliaryChangeVector);
+ friend QDataStream &operator>>(QDataStream &in, ChangeAuxiliaryCommand &command)
+ {
+ in >> command.auxiliaryChanges;
+ return in;
+ }
+
+ friend QDataStream &operator<<(QDataStream &out, const ChangeAuxiliaryCommand &command)
+ {
+ out << command.auxiliaryChanges;
+ return out;
+ }
- QVector<PropertyValueContainer> auxiliaryChanges() const;
+ friend QDebug operator <<(QDebug debug, const ChangeAuxiliaryCommand &command);
-private:
- QVector<PropertyValueContainer> m_auxiliaryChangeVector;
+ QVector<PropertyValueContainer> auxiliaryChanges;
};
-QDataStream &operator<<(QDataStream &out, const ChangeAuxiliaryCommand &command);
-QDataStream &operator>>(QDataStream &in, ChangeAuxiliaryCommand &command);
-
-QDebug operator <<(QDebug debug, const ChangeAuxiliaryCommand &command);
-
} // namespace QmlDesigner
Q_DECLARE_METATYPE(QmlDesigner::ChangeAuxiliaryCommand)
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
index ce5cf29953..1148e0c6d2 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/nodeinstanceserver.cpp
@@ -633,7 +633,7 @@ void NodeInstanceServer::changePropertyValues(const ChangeValuesCommand &command
void NodeInstanceServer::changeAuxiliaryValues(const ChangeAuxiliaryCommand &command)
{
- foreach (const PropertyValueContainer &container, command.auxiliaryChanges()) {
+ for (const PropertyValueContainer &container : command.auxiliaryChanges) {
setInstanceAuxiliaryData(container);
}
diff --git a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp
index fed075a486..3e635909ec 100644
--- a/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp
+++ b/share/qtcreator/qml/qmlpuppet/qml2puppet/instances/qt5testnodeinstanceserver.cpp
@@ -116,7 +116,7 @@ void Qt5TestNodeInstanceServer::changePropertyBindings(const ChangeBindingsComma
void Qt5TestNodeInstanceServer::changeAuxiliaryValues(const ChangeAuxiliaryCommand &command)
{
- foreach (const PropertyValueContainer &container, command.auxiliaryChanges()) {
+ for (const PropertyValueContainer &container : command.auxiliaryChanges) {
setInstanceAuxiliaryData(container);
}