diff --git a/sources/editor/editorcommands.cpp b/sources/editor/editorcommands.cpp index a3e8a2f40..1f081858f 100644 --- a/sources/editor/editorcommands.cpp +++ b/sources/editor/editorcommands.cpp @@ -236,7 +236,9 @@ void AddPartCommand::undo() { void AddPartCommand::redo() { // le premier appel a redo, lors de la construction de l'objet, ne doit pas se faire if (first_redo) { - part -> setZValue(editor_scene -> items().count()); + QList existing_items = editor_scene -> zItems(); + qreal z = existing_items.count() ? existing_items.last() -> zValue() + 1 : 1; + part -> setZValue(z); editor_scene -> clearSelection(); part -> setSelected(true); first_redo = false; diff --git a/sources/editor/elementscene.cpp b/sources/editor/elementscene.cpp index 32e8ef47a..8784f31c4 100644 --- a/sources/editor/elementscene.cpp +++ b/sources/editor/elementscene.cpp @@ -1211,7 +1211,7 @@ ElementContent ElementScene::loadContent(const QDomDocument &xml_document, QStri else if (qde.tagName() == "arc") cep = new PartArc (element_editor, 0, 0); else continue; if (QGraphicsItem *qgi = dynamic_cast(cep)) { - qgi -> setZValue(z++); + if (!qgi -> zValue()) qgi -> setZValue(z++); loaded_parts << qgi; } cep -> fromXml(qde);