37 QUndoCommand(text, parent),
86 const QList<QGraphicsItem *>& parts,
93 m_scene -> qgiManager().manage(qgi);
100 m_scene -> qgiManager().release(qgi);
110 m_scene -> blockSignals(
false);
119 m_scene -> blockSignals(
false);
152 foreach(QGraphicsItem *part,
content_) {
155 m_scene -> blockSignals(
false);
160 m_view -> adjustSceneRect();
169 foreach(QGraphicsItem *part,
content_) {
172 m_scene -> blockSignals(
false);
179 m_view -> adjustSceneRect();
204 const QList<QGraphicsItem *>& parts,
209 setText(QString(
QObject::tr(
"couper des parties",
"undo caption")));
227 const QList<QGraphicsItem *>& parts,
291 if (!
part -> zValue()) {
295 qreal z = existing_items.count() ? existing_items.last() -> zValue() + 1 : 1;
296 part -> setZValue(z);
319 names_before(before),
356 foreach(QGraphicsItem *qgi, items_list)
undo_hash.insert(qgi, qgi -> zValue());
360 setText(
QObject::tr(
"amener au premier plan",
"undo caption"));
363 setText(
QObject::tr(
"rapprocher",
"undo caption"));
369 setText(
QObject::tr(
"envoyer au fond",
"undo caption"));
393 QList<QGraphicsItem *> non_selected_items = items_list;
394 QList<QGraphicsItem *> selected_items;
395 foreach(QGraphicsItem *qgi, non_selected_items) {
396 if (qgi -> isSelected()) {
397 selected_items << qgi;
398 non_selected_items.removeAt(non_selected_items.indexOf(qgi));
402 foreach(QGraphicsItem *qgi, non_selected_items)
redo_hash.insert(qgi, z ++);
403 foreach(QGraphicsItem *qgi, selected_items)
redo_hash.insert(qgi, z ++);
411 QList<QGraphicsItem *> my_items_list = items_list;
413 for (
int i = my_items_list.count() - 2 ; i >= 0 ; -- i) {
414 if (my_items_list[i] -> isSelected()) {
415 if (!my_items_list[i +1] -> isSelected()) {
416 my_items_list.swap(i, i + 1);
421 foreach(QGraphicsItem *qgi, my_items_list)
redo_hash.insert(qgi, z ++);
429 QList<QGraphicsItem *> my_items_list = items_list;
431 for (
int i = 1 ; i < my_items_list.count() ; ++ i) {
432 if (my_items_list[i] -> isSelected()) {
433 if (!my_items_list[i - 1] -> isSelected()) {
434 my_items_list.swap(i, i - 1);
440 foreach(QGraphicsItem *qgi, my_items_list)
redo_hash.insert(qgi, z ++);
448 QList<QGraphicsItem *> non_selected_items = items_list;
449 QList<QGraphicsItem *> selected_items;
450 foreach(QGraphicsItem *qgi, non_selected_items) {
451 if (qgi -> isSelected()) {
452 selected_items << qgi;
453 non_selected_items.removeAt(non_selected_items.indexOf(qgi));
457 foreach(QGraphicsItem *qgi, selected_items)
redo_hash.insert(qgi, z ++);
458 foreach(QGraphicsItem *qgi, non_selected_items)
redo_hash.insert(qgi, z ++);
469 ElementEditionCommand(QObject::
tr(
"modification informations complementaires",
"undo caption"), elmt, nullptr, parent),
470 old_informations_(old_infos),
471 new_informations_(new_infos)
569 if (before == after)
return;
570 if (!before.width() || !before.height())
return;
573 part_item -> startUserTransformation(before);
574 part_item -> handleUserTransformation(before, after);
583 setText(
QObject::tr(
"redimensionnement %1",
"undo caption -- %1 is the resized primitive type name").arg(
scaled_primitives_.first() -> name()));
QPair< QRectF, QRectF > transformation()
void setElementScene(ElementScene *)
void applyBringForward(const QList< QGraphicsItem *> &)
void redo() override
Refait les changements de zValue.
~ElementEditionCommand() override
void redo() override
Refait le deplacement.
ElementScene * elementScene() const
Send item one layer below their current one; zValues are decremented.
void undo() override
annule le coller
DiagramContext m_elmt_kindInfo
element type
Raise item one layer above their current one; zValues are incremented.
ElementScene * elementScene() const
~ChangeNamesCommand() override
Destructeur.
~ScalePartsCommand() override
QPointF old_start_top_left_corner_
ElementEditionCommand(ElementScene *=nullptr, ElementView *=nullptr, QUndoCommand *=nullptr)
QPointF new_start_top_left_corner_
void undo() override
Annule le deplacement.
void setScaledPrimitives(const QList< CustomElementPart *> &)
void redo() override
Refait l'ajout.
QList< QGraphicsItem * > deleted_parts
Deleted primitives.
void undo() override
Annule l'ajout.
ElementView * elementView() const
ElementScene * m_scene
Element editor/view/scene the command should take place on.
Bring item to the foreground so they have the highest zValue.
void setElementView(ElementView *)
ElementContent content_
Pasted content.
void undo() override
Annule les changements de zValue.
~ChangePropertiesCommand() override
bool first_redo
Prevent the first call to redo()
void redo() override
Refait le changement.
CutPartsCommand(ElementScene *, const QList< QGraphicsItem *> &, QUndoCommand *=nullptr)
~AddPartCommand() override
Destructeur.
QRectF original_rect_
original rect items fit in
The ElementEditionCommand class ElementEditionCommand is the base class for all commands classes invo...
~ChangeZValueCommand() override
Destructeur.
QList< CustomElementPart * > scaledPrimitives() const
~PastePartsCommand() override
Destructeur.
QPointF movement
applied movement
bool first_redo
Prevent the first call to redo()
QGraphicsItem * part
Added primitive.
QList< CustomElementPart * > scaled_primitives_
List of moved primitives.
void undo() override
Annule le changement.
QHash< QGraphicsItem *, qreal > redo_hash
associates impacted primitives with their new zValues
DepthOption
List the various kind of changes for the zValue.
ChangePropertiesCommand(ElementScene *scene, const QString &type, const DiagramContext &info, const DiagramContext &elmt_info, QUndoCommand *parent=nullptr)
ChangePropertiesCommand::ChangePropertiesCommand Change the properties of the drawed element...
NamesList names_before
List of former names.
QList< DiagramContext > m_kind_info
~CutPartsCommand() override
Destructeur.
QRectF new_rect_
new rect items should fit in
ChangeNamesCommand(ElementScene *, const NamesList &, const NamesList &, QUndoCommand *=nullptr)
DeletePartsCommand(ElementScene *, const QList< QGraphicsItem *> &, QUndoCommand *=nullptr)
PastePartsCommand(ElementView *, const ElementContent &, QUndoCommand *=nullptr)
QString m_elmt_type
Extra informations.
void redo() override
Supprime les parties.
AddPartCommand(const QString &, ElementScene *, QGraphicsItem *, QUndoCommand *=nullptr)
QList< QGraphicsItem * > moved_parts
List of moved primitives.
void applyLower(const QList< QGraphicsItem *> &)
DiagramContext m_elmt_information
int new_offset_paste_count_
ChangeZValueCommand(ElementScene *, QET::DepthOption, QUndoCommand *=nullptr)
void redo() override
refait le coller
virtual void setOffset(int, const QPointF &, int, const QPointF &)
void applySendBackward(const QList< QGraphicsItem *> &)
void setTransformation(const QRectF &, const QRectF &)
ScalePartsCommand(ElementScene *=nullptr, QUndoCommand *=nullptr)
~MovePartsCommand() override
Destructeur.
NamesList names_after
List of new names.
QList< QGraphicsItem * > ElementContent
Send item to the background so they have the lowest zValue.
int old_offset_paste_count_
Data required to undo a copy/paste with offset.
void undo() override
Restaure les parties supprimees.
QET::DepthOption m_option
kind of treatment to apply
void scale(const QRectF &before, const QRectF &after)
QHash< QGraphicsItem *, qreal > undo_hash
associates impacted primitives with their former zValues
MovePartsCommand(const QPointF &, ElementScene *, const QList< QGraphicsItem *> &, QUndoCommand *=nullptr)
bool first_redo
Prevent the first call to redo()
void setElementInfo(const DiagramContext &dc)
bool first_redo
Prevent the first call to redo()
void applyRaise(const QList< QGraphicsItem *> &)
~DeletePartsCommand() override
Destructeur : detruit egalement les parties supprimees.
QList< DiagramContext > m_elmt_info