29 #include <QPropertyAnimation> 103 if (settings.value(
"diagramcommands/erase-label-on-copy",
true).toBool())
111 e->setElementInformations(dc);
118 cp.
text = c->diagram() ? c ->
diagram() -> defaultConductorProperties.text :
"_";
119 c -> setProperties(cp);
127 for (QGraphicsItem *item : qgis_list) {
132 const QList <QGraphicsItem *> qgis_list =
content.
items();
133 for (QGraphicsItem *qgi : qgis_list)
134 qgi -> setSelected(
true);
154 "undo caption - %1 is a sentence listing the content to cut" 178 QUndoCommand (parent),
180 content_to_move (diagram_content),
182 m_anim_group (nullptr),
199 "undo caption - %1 is a sentence listing the moved content" 200 ).arg(moved_content_sentence)
220 QUndoCommand::undo();
236 QUndoCommand::redo();
249 for (QGraphicsItem *qgi :
content_to_move.
items(dc::Elements | dc::TextFields | dc::Images | dc::Shapes | dc::TextGroup | dc::ElementTextFields))
253 if (qgi->parentItem())
257 if(qgi->toGraphicsObject())
258 setupAnimation(qgi->toGraphicsObject(),
"pos", qgi->pos(), qgi->pos() + actual_movement);
259 else if(qgi->type() == QGraphicsItemGroup::Type)
262 setupAnimation(etig,
"pos", etig->pos(), etig->pos() + actual_movement);
264 else qgi -> setPos(qgi->pos() + actual_movement);
287 QPropertyAnimation *animation =
new QPropertyAnimation(target, propertyName);
288 animation->setDuration(300);
289 animation->setStartValue(start);
290 animation->setEndValue(end);
291 animation->setEasingCurve(QEasingCurve::OutQuad);
307 QUndoCommand(parent),
324 cti -> forceMovedByUser(was_already_moved);
325 if (was_already_moved) {
326 cti -> setPos(cti -> pos() - movement);
340 cti -> forceMovedByUser(
true);
341 cti -> setPos(cti -> pos() + movement);
358 texts_to_move_.insert(text_item, qMakePair(new_pos - old_pos, already_moved));
374 "undo caption - %1 is a sentence listing the moved content" 375 ).arg(moved_content_sentence)
389 const QString &before,
390 const QString &after,
393 QUndoCommand(QObject::
tr(
"modifier le texte",
"undo caption"), parent),
398 diagram(dti->diagram())
436 QUndoCommand(QObject::
tr(
"modifier un conducteur",
"undo caption"), parent),
442 diagram (c->diagram())
485 const QHash<Conductor *, ConductorProfilesGroup> &cp,
488 QUndoCommand(parent),
489 conductors_profiles(cp),
490 diagram(cp.keys().first()->diagram())
495 "undo caption - %1 is a sentence listing the reset content" 522 c -> textItem() -> forceMovedByUser (
false);
523 c -> textItem() -> forceRotateByUser (
false);
536 QUndoCommand(QObject::
tr(
"modifier les dimensions du folio",
"undo caption"), parent),
538 old_properties(old_bp),
539 new_properties(new_bp)
QString itemText(const QetGraphicsItem *item)
Diagram * diagram
modified diagram
void setHtml(const QString &text)
~ResetConductorCommand() override
ResetConductorCommand::~ResetConductorCommand.
int filter
filter stating what kinds of items should be pasted
void undo() override
Annule la modification du conducteur.
QPointF movement
applied movement
ChangeDiagramTextCommand(DiagramTextItem *, const QString &before, const QString &after, QUndoCommand *=nullptr)
Conductor * conductor
changed conductor
QParallelAnimationGroup * m_anim_group
animation group
QString sentence(int=All) const
DiagramContent::sentence.
QString text_before
former text
~ChangeBorderCommand() override
Destructeur.
Qt::Corner path_type
Path type of the modified conductor.
QList< Conductor * > m_conductors_to_move
Diagram * diagram
diagram the movement takes place on.
virtual void setConductorTextItemMove(const QPointF &, const QPointF &)
MoveConductorsTextsCommand(Diagram *, QUndoCommand *=nullptr)
~CutDiagramCommand() override
Destructeur.
bool addValue(const QString &, const QVariant &, bool show=true)
QList< QGraphicsItem * > items(int=All) const
DiagramContent::items.
QHash< Qt::Corner, ConductorProfile > ConductorProfilesGroup
void undo() override
annule la modification de texte
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Réimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
virtual void move(const QPointF &)
MoveElementsCommand::move Move item and conductor to .
ChangeConductorCommand(Conductor *, const ConductorProfile &, const ConductorProfile &, Qt::Corner, QUndoCommand *=nullptr)
bool first_redo
prevent the first call to redo()
void redo() override
MoveElementsCommand::redo.
void undo() override
annule le deplacement
void undo() override
PasteDiagramCommand::undo Undo this command.
virtual void addTextMovement(ConductorTextItem *, const QPointF &, const QPointF &, bool=false)
Diagram * diagram
diagram the movement takes place on.
ResetConductorCommand(const QHash< Conductor *, ConductorProfilesGroup > &, QUndoCommand *=nullptr)
ResetConductorCommand::ResetConductorCommand.
QString ElementsAndConductorsSentence(int, int, int=0, int=0, int=0, int=0)
void redo() override
Refait la modification du conducteur.
CutDiagramCommand(Diagram *, const DiagramContent &, QUndoCommand *=nullptr)
ConductorProfile new_profile
profile after the change
~ChangeDiagramTextCommand() override
destructeur
MoveElementsCommand(Diagram *, const DiagramContent &, const QPointF &m, QUndoCommand *=nullptr)
MoveElementsCommand::MoveElementsCommand Constructor.
bool first_redo
prevent the first call to redo()
void redo() override
ChangeDiagramTextCommand::redo.
~MoveElementsCommand() override
MoveElementsCommand::~MoveElementsCommand Destructor.
ChangeBorderCommand(Diagram *, const BorderProperties &, const BorderProperties &, QUndoCommand *=nullptr)
DiagramTextItem * text_item
modified text item
~ChangeConductorCommand() override
Destructeur.
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
BorderProperties old_properties
properties before the change
void undo() override
Annule les changements apportes au schema.
PasteDiagramCommand(Diagram *, const DiagramContent &, QUndoCommand *=nullptr)
PasteDiagramCommand::PasteDiagramCommand Constructor.
QList< Element * > m_elements
QList< Conductor * > m_conductors_to_update
DiagramContent content_to_move
moved content
QHash< ConductorTextItem *, QPair< QPointF, bool > > texts_to_move_
text items to be moved
void regenerateTextLabel()
QString text_after
new text
DiagramContent content
pasted content
void redo() override
Refait les changements apportes au schema.
void redo() override
PasteDiagramCommand::redo Redo this commnand.
void redo() override
ResetConductorCommand::redo.
void undo() override
ResetConductorCommand::undo.
QPointF text_pos_before_mov_
position of the text item before the change
void undo() override
MoveElementsCommand::undo.
BorderProperties new_properties
properties after the change
QPointF text_pos_after_mov_
position of the text item after the change
~MoveConductorsTextsCommand() override
Destructeur.
~PasteDiagramCommand() override
PasteDiagramCommand::~PasteDiagramCommand Destructor.
ConductorProfile old_profile
profile before the change
virtual QString name() const
virtual void addItem(QGraphicsItem *item)
Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific ope...
void setupAnimation(QObject *target, const QByteArray &propertyName, const QVariant &start, const QVariant &end)
MoveElementsCommand::setupAnimation Set up the animation for this undo command.
Diagram * diagram
diagram content is pasted onto
bool first_redo
prevent the first call to redo()
QHash< Conductor *, ConductorProfilesGroup > conductors_profiles
impacted conductors along with their former profiles
void redo() override
refait le deplacement
bool first_redo
prevent the first call to redo()