mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-01-06 22:00:52 +01:00
correct more indentations / whitespace
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "addgraphicsobjectcommand.h"
|
||||
#include "../qetgraphicsitem/qetgraphicsitem.h"
|
||||
@@ -30,21 +30,21 @@
|
||||
* @param parent : parent undo command of this class.
|
||||
*/
|
||||
AddGraphicsObjectCommand::AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram,
|
||||
const QPointF &pos, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_item(qgo),
|
||||
m_diagram(diagram),
|
||||
m_pos(pos)
|
||||
const QPointF &pos, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_item(qgo),
|
||||
m_diagram(diagram),
|
||||
m_pos(pos)
|
||||
{
|
||||
setText(QObject::tr("Ajouter ") + itemText());
|
||||
m_diagram->qgiManager().manage(m_item);
|
||||
m_diagram->qgiManager().manage(m_item);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief AddGraphicsObjectCommand::~AddGraphicsObjectCommand
|
||||
*/
|
||||
AddGraphicsObjectCommand::~AddGraphicsObjectCommand() {
|
||||
m_diagram->qgiManager().release(m_item);
|
||||
m_diagram->qgiManager().release(m_item);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,12 +53,12 @@ AddGraphicsObjectCommand::~AddGraphicsObjectCommand() {
|
||||
*/
|
||||
void AddGraphicsObjectCommand::undo()
|
||||
{
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->removeItem(m_item);
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->removeItem(m_item);
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,13 +67,13 @@ void AddGraphicsObjectCommand::undo()
|
||||
*/
|
||||
void AddGraphicsObjectCommand::redo()
|
||||
{
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->addItem(m_item);
|
||||
m_item->setPos(m_pos);
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
if (m_item)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_diagram->addItem(m_item);
|
||||
m_item->setPos(m_pos);
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -83,12 +83,12 @@ void AddGraphicsObjectCommand::redo()
|
||||
QString AddGraphicsObjectCommand::itemText() const
|
||||
{
|
||||
if (auto qgi = dynamic_cast<QetGraphicsItem *>(m_item.data())) {
|
||||
return qgi->name();
|
||||
return qgi->name();
|
||||
} else if (dynamic_cast<IndependentTextItem *>(m_item.data())) {
|
||||
return QObject::tr("un champ texte");
|
||||
} else if (dynamic_cast<Conductor *>(m_item.data())) {
|
||||
return QObject::tr("un conducteur");
|
||||
} else {
|
||||
return QObject::tr("un element graphique");
|
||||
}
|
||||
return QObject::tr("un conducteur");
|
||||
} else {
|
||||
return QObject::tr("un element graphique");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef ADDGRAPHICSOBJECTCOMMAND_H
|
||||
#define ADDGRAPHICSOBJECTCOMMAND_H
|
||||
@@ -32,21 +32,21 @@ class Diagram;
|
||||
class AddGraphicsObjectCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram,
|
||||
const QPointF &pos = QPointF(),
|
||||
QUndoCommand *parent = nullptr);
|
||||
~AddGraphicsObjectCommand() override;
|
||||
AddGraphicsObjectCommand(QGraphicsObject *qgo, Diagram *diagram,
|
||||
const QPointF &pos = QPointF(),
|
||||
QUndoCommand *parent = nullptr);
|
||||
~AddGraphicsObjectCommand() override;
|
||||
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
QString itemText() const;
|
||||
private:
|
||||
QString itemText() const;
|
||||
|
||||
private:
|
||||
QPointer<QGraphicsObject> m_item;
|
||||
Diagram *m_diagram = nullptr;
|
||||
QPointF m_pos;
|
||||
private:
|
||||
QPointer<QGraphicsObject> m_item;
|
||||
Diagram *m_diagram = nullptr;
|
||||
QPointF m_pos;
|
||||
};
|
||||
|
||||
#endif // ADDGRAPHICSOBJECTCOMMAND_H
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "changeelementdatacommand.h"
|
||||
#include "../qetgraphicsitem/element.h"
|
||||
|
||||
ChangeElementDataCommand::ChangeElementDataCommand(Element *element, ElementData new_data, QUndoCommand *parent) :
|
||||
QUndoCommand(parent),
|
||||
m_element(element),
|
||||
m_old_data(element->elementData()),
|
||||
m_new_data(new_data)
|
||||
m_element(element),
|
||||
m_old_data(element->elementData()),
|
||||
m_new_data(new_data)
|
||||
{
|
||||
setText(QObject::tr("Modifier les propriétés d'un élement"));
|
||||
setText(QObject::tr("Modifier les propriétés d'un élement"));
|
||||
}
|
||||
|
||||
void ChangeElementDataCommand::undo() {
|
||||
if (m_element) {
|
||||
if (m_element) {
|
||||
m_element.data()->setElementData(m_old_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeElementDataCommand::redo() {
|
||||
if (m_element) {
|
||||
if (m_element) {
|
||||
m_element.data()->setElementData(m_new_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
Copyright 2006-2024 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef CHANGEELEMENTDATACOMMAND_H
|
||||
#define CHANGEELEMENTDATACOMMAND_H
|
||||
@@ -25,14 +25,14 @@ class Element;
|
||||
|
||||
class ChangeElementDataCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ChangeElementDataCommand(Element *element, ElementData new_data, QUndoCommand *parent = nullptr);
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
void undo() override;
|
||||
void redo() override;
|
||||
|
||||
private:
|
||||
QPointer<Element> m_element;
|
||||
ElementData m_old_data, m_new_data;
|
||||
private:
|
||||
QPointer<Element> m_element;
|
||||
ElementData m_old_data, m_new_data;
|
||||
};
|
||||
|
||||
#endif // CHANGEELEMENTDATACOMMAND_H
|
||||
|
||||
@@ -30,15 +30,15 @@ class QAbstractItemModel;
|
||||
*/
|
||||
class ModelIndexCommand : public QUndoCommand
|
||||
{
|
||||
public:
|
||||
public:
|
||||
ModelIndexCommand(QAbstractItemModel *model, const QModelIndex &index, QUndoCommand *parent = nullptr);
|
||||
void setData(const QVariant &value, int role = Qt::DisplayRole);
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
QPointer<QAbstractItemModel> m_model;
|
||||
private:
|
||||
QPointer<QAbstractItemModel> m_model;
|
||||
QModelIndex m_index;
|
||||
QVariant m_old_value,
|
||||
m_new_value;
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/*
|
||||
Copyright 2006-2022 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
Copyright 2006-2022 The QElectroTech Team
|
||||
This file is part of QElectroTech.
|
||||
|
||||
QElectroTech is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
QElectroTech is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <QGraphicsItemGroup>
|
||||
#include <QPropertyAnimation>
|
||||
@@ -33,25 +33,25 @@
|
||||
* @param parent : parent undo command
|
||||
*/
|
||||
MoveGraphicsItemCommand::MoveGraphicsItemCommand(Diagram *diagram,
|
||||
const DiagramContent &content,
|
||||
const QPointF &movement,
|
||||
QUndoCommand *parent) :
|
||||
QUndoCommand{parent},
|
||||
m_diagram{diagram},
|
||||
m_content{content},
|
||||
m_movement{movement}
|
||||
const DiagramContent &content,
|
||||
const QPointF &movement,
|
||||
QUndoCommand *parent) :
|
||||
QUndoCommand{parent},
|
||||
m_diagram{diagram},
|
||||
m_content{content},
|
||||
m_movement{movement}
|
||||
{
|
||||
const auto moved_content_sentence = m_content.sentence(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::ConductorsToUpdate
|
||||
| DiagramContent::ConductorsToMove
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::TerminalStrip);
|
||||
const auto moved_content_sentence = m_content.sentence(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::ConductorsToUpdate
|
||||
| DiagramContent::ConductorsToMove
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::TerminalStrip);
|
||||
|
||||
setText(QString(QObject::tr("déplacer %1",
|
||||
"undo caption - %1 is a sentence listing the moved content").arg(moved_content_sentence)));
|
||||
setText(QString(QObject::tr("déplacer %1",
|
||||
"undo caption - %1 is a sentence listing the moved content").arg(moved_content_sentence)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,13 +60,13 @@ MoveGraphicsItemCommand::MoveGraphicsItemCommand(Diagram *diagram,
|
||||
*/
|
||||
void MoveGraphicsItemCommand::undo()
|
||||
{
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_anim_group.setDirection(QAnimationGroup::Forward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
m_anim_group.setDirection(QAnimationGroup::Forward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
QUndoCommand::undo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,21 +75,21 @@ void MoveGraphicsItemCommand::undo()
|
||||
*/
|
||||
void MoveGraphicsItemCommand::redo()
|
||||
{
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
if (m_first_redo)
|
||||
{
|
||||
m_first_redo = false;
|
||||
move(-m_movement);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_anim_group.setDirection(QAnimationGroup::Backward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
if (m_diagram)
|
||||
{
|
||||
m_diagram->showMe();
|
||||
if (m_first_redo)
|
||||
{
|
||||
m_first_redo = false;
|
||||
move(-m_movement);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_anim_group.setDirection(QAnimationGroup::Backward);
|
||||
m_anim_group.start();
|
||||
}
|
||||
}
|
||||
QUndoCommand::redo();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,57 +99,57 @@ void MoveGraphicsItemCommand::redo()
|
||||
*/
|
||||
void MoveGraphicsItemCommand::move(const QPointF &movement)
|
||||
{
|
||||
for (auto &&qgi : m_content.items(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::TextGroup
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::Tables
|
||||
| DiagramContent::TerminalStrip))
|
||||
{
|
||||
//If item have a parent and the parent is in m_content,
|
||||
//we don't apply movement because this item will be moved by his parent
|
||||
if (const auto parent_ = qgi->parentItem()) {
|
||||
if (m_content.items().contains(parent_)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
for (auto &&qgi : m_content.items(DiagramContent::Elements
|
||||
| DiagramContent::TextFields
|
||||
| DiagramContent::Images
|
||||
| DiagramContent::Shapes
|
||||
| DiagramContent::TextGroup
|
||||
| DiagramContent::ElementTextFields
|
||||
| DiagramContent::Tables
|
||||
| DiagramContent::TerminalStrip))
|
||||
{
|
||||
//If item have a parent and the parent is in m_content,
|
||||
//we don't apply movement because this item will be moved by his parent
|
||||
if (const auto parent_ = qgi->parentItem()) {
|
||||
if (m_content.items().contains(parent_)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto graphics_object = qgi->toGraphicsObject()) {
|
||||
setupAnimation(graphics_object,
|
||||
"pos",
|
||||
graphics_object->pos(),
|
||||
graphics_object->pos() + movement);
|
||||
}
|
||||
else if (qgi->type() == QGraphicsItemGroup::Type)
|
||||
{
|
||||
//ElementTextItemGroup is a QObject not a QGraphicsObject
|
||||
if (ElementTextItemGroup *etig = dynamic_cast<ElementTextItemGroup *>(qgi)) {
|
||||
setupAnimation(etig,
|
||||
"pos",
|
||||
etig->pos(),
|
||||
etig->pos() + movement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qgi->setPos(qgi->pos() + movement);
|
||||
}
|
||||
}
|
||||
if (const auto graphics_object = qgi->toGraphicsObject()) {
|
||||
setupAnimation(graphics_object,
|
||||
"pos",
|
||||
graphics_object->pos(),
|
||||
graphics_object->pos() + movement);
|
||||
}
|
||||
else if (qgi->type() == QGraphicsItemGroup::Type)
|
||||
{
|
||||
//ElementTextItemGroup is a QObject not a QGraphicsObject
|
||||
if (ElementTextItemGroup *etig = dynamic_cast<ElementTextItemGroup *>(qgi)) {
|
||||
setupAnimation(etig,
|
||||
"pos",
|
||||
etig->pos(),
|
||||
etig->pos() + movement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
qgi->setPos(qgi->pos() + movement);
|
||||
}
|
||||
}
|
||||
|
||||
//Move some conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_move)) {
|
||||
setupAnimation(conductor,
|
||||
"pos",
|
||||
conductor->pos(),
|
||||
conductor->pos() + movement);
|
||||
}
|
||||
//Move some conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_move)) {
|
||||
setupAnimation(conductor,
|
||||
"pos",
|
||||
conductor->pos(),
|
||||
conductor->pos() + movement);
|
||||
}
|
||||
|
||||
//Recalcul the path of other conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_update)) {
|
||||
setupAnimation(conductor, "animPath", 1, 1);
|
||||
}
|
||||
//Recalcul the path of other conductors
|
||||
for (const auto &conductor : qAsConst(m_content.m_conductors_to_update)) {
|
||||
setupAnimation(conductor, "animPath", 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -162,14 +162,14 @@ void MoveGraphicsItemCommand::move(const QPointF &movement)
|
||||
* @param end
|
||||
*/
|
||||
void MoveGraphicsItemCommand::setupAnimation(QObject *target,
|
||||
const QByteArray &property_name,
|
||||
const QVariant &start,
|
||||
const QVariant &end)
|
||||
const QByteArray &property_name,
|
||||
const QVariant &start,
|
||||
const QVariant &end)
|
||||
{
|
||||
QPropertyAnimation *animation{new QPropertyAnimation(target, property_name)};
|
||||
animation->setDuration(300);
|
||||
animation->setStartValue(start);
|
||||
animation->setEndValue(end);
|
||||
animation->setEasingCurve(QEasingCurve::OutQuad);
|
||||
m_anim_group.addAnimation(animation);
|
||||
QPropertyAnimation *animation{new QPropertyAnimation(target, property_name)};
|
||||
animation->setDuration(300);
|
||||
animation->setStartValue(start);
|
||||
animation->setEndValue(end);
|
||||
animation->setEasingCurve(QEasingCurve::OutQuad);
|
||||
m_anim_group.addAnimation(animation);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user