Element editor: fixed yet another bug in the zValue choice for newly added parts.

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@1827 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2012-05-12 22:03:07 +00:00
parent 4a200bbcf5
commit fa5ec6f597

View File

@@ -236,9 +236,13 @@ 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) {
QList<QGraphicsItem *> existing_items = editor_scene -> zItems();
qreal z = existing_items.count() ? existing_items.last() -> zValue() + 1 : 1;
part -> setZValue(z);
if (!part -> zValue()) {
// the added part has no specific zValue already defined, we put it
// above existing items (but still under terminals)
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;