Element editor: fixed a bug when determining the zValue for a newly added part.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1806 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-05-11 21:27:31 +00:00
parent 35e960a0cf
commit b7feb25dbd
2 changed files with 4 additions and 2 deletions

View File

@@ -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<QGraphicsItem *> 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;

View File

@@ -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<QGraphicsItem *>(cep)) {
qgi -> setZValue(z++);
if (!qgi -> zValue()) qgi -> setZValue(z++);
loaded_parts << qgi;
}
cep -> fromXml(qde);