2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
2011-02-22 12:08:19 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-11-24 14:52:06 +01:00
|
|
|
|
|
|
|
|
#include <QMetaType>
|
|
|
|
|
#include <QVector>
|
|
|
|
|
|
|
|
|
|
#include "propertyvaluecontainer.h"
|
|
|
|
|
|
|
|
|
|
namespace QmlDesigner {
|
|
|
|
|
|
|
|
|
|
class ValuesChangedCommand
|
|
|
|
|
{
|
2012-09-11 15:11:34 +02:00
|
|
|
friend QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command);
|
2010-11-24 14:52:06 +01:00
|
|
|
friend QDataStream &operator>>(QDataStream &in, ValuesChangedCommand &command);
|
2013-07-04 17:06:31 +02:00
|
|
|
friend bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second);
|
2010-11-24 14:52:06 +01:00
|
|
|
|
|
|
|
|
public:
|
2019-10-29 17:16:03 +01:00
|
|
|
enum TransactionOption { Start = 1, End = 2, None = 0 };
|
2010-11-24 14:52:06 +01:00
|
|
|
ValuesChangedCommand();
|
2013-06-06 16:03:46 +02:00
|
|
|
explicit ValuesChangedCommand(const QVector<PropertyValueContainer> &valueChangeVector);
|
2010-11-24 14:52:06 +01:00
|
|
|
|
2019-10-18 16:55:08 +02:00
|
|
|
const QVector<PropertyValueContainer> valueChanges() const;
|
2012-09-11 15:11:34 +02:00
|
|
|
quint32 keyNumber() const;
|
|
|
|
|
|
|
|
|
|
static void removeSharedMemorys(const QVector<qint32> &keyNumberVector);
|
2010-11-24 14:52:06 +01:00
|
|
|
|
2013-07-04 17:06:31 +02:00
|
|
|
void sort();
|
2019-10-25 15:47:43 +02:00
|
|
|
TransactionOption transactionOption = TransactionOption::None;
|
2013-07-04 17:06:31 +02:00
|
|
|
|
2010-11-24 14:52:06 +01:00
|
|
|
private:
|
|
|
|
|
QVector<PropertyValueContainer> m_valueChangeVector;
|
2012-09-11 15:11:34 +02:00
|
|
|
mutable quint32 m_keyNumber;
|
2010-11-24 14:52:06 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
QDataStream &operator<<(QDataStream &out, const ValuesChangedCommand &command);
|
|
|
|
|
QDataStream &operator>>(QDataStream &in, ValuesChangedCommand &command);
|
|
|
|
|
|
2013-07-04 17:06:31 +02:00
|
|
|
bool operator ==(const ValuesChangedCommand &first, const ValuesChangedCommand &second);
|
2013-07-16 17:00:07 +02:00
|
|
|
QDebug operator <<(QDebug debug, const ValuesChangedCommand &instance);
|
2019-10-18 16:55:08 +02:00
|
|
|
|
|
|
|
|
/* ValuesChangedCommand is used to notify that the values of a specific instatiated
|
|
|
|
|
* QObject changed.
|
|
|
|
|
* The ValuesModifiedCommand is used to notify that a user changed a QML property and
|
|
|
|
|
* that this property should be changed in the data model.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
class ValuesModifiedCommand : public ValuesChangedCommand
|
|
|
|
|
{
|
|
|
|
|
public:
|
2019-10-25 15:47:43 +02:00
|
|
|
ValuesModifiedCommand() = default;
|
|
|
|
|
|
2019-10-18 16:55:08 +02:00
|
|
|
explicit ValuesModifiedCommand(const QVector<PropertyValueContainer> &valueChangeVector)
|
|
|
|
|
: ValuesChangedCommand(valueChangeVector)
|
|
|
|
|
{}
|
|
|
|
|
};
|
|
|
|
|
|
2019-11-12 14:39:55 -08:00
|
|
|
QDataStream &operator<<(QDataStream &out, const ValuesModifiedCommand &command);
|
|
|
|
|
QDataStream &operator>>(QDataStream &in, ValuesModifiedCommand &command);
|
|
|
|
|
|
2010-11-24 14:52:06 +01:00
|
|
|
} // namespace QmlDesigner
|
|
|
|
|
|
2019-10-18 16:55:08 +02:00
|
|
|
|
|
|
|
|
Q_DECLARE_METATYPE(QmlDesigner::ValuesModifiedCommand)
|
2010-12-16 11:25:28 +01:00
|
|
|
Q_DECLARE_METATYPE(QmlDesigner::ValuesChangedCommand)
|