Element editor: revamped ElementScene::zItems() to fulfil the needs of ElementScene::managePrimitivesGroups()

git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2029 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
xavier
2013-02-08 22:05:20 +00:00
parent 1ba32a5b27
commit e78b0d5804
4 changed files with 57 additions and 28 deletions

View File

@@ -291,7 +291,7 @@ void AddPartCommand::redo() {
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();
QList<QGraphicsItem *> existing_items = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
qreal z = existing_items.count() ? existing_items.last() -> zValue() + 1 : 1;
part -> setZValue(z);
}
@@ -522,8 +522,8 @@ ChangeZValueCommand::ChangeZValueCommand(
ElementEditionCommand(elmt, 0, parent),
option(o)
{
// recupere les parties de l'elements, sauf les bornes
QList<QGraphicsItem *> items_list = editor_scene_ -> zItems();
// retrieve all primitives but terminals
QList<QGraphicsItem *> items_list = editor_scene_ -> zItems(ElementScene::SortByZValue | ElementScene::SelectedOrNot);
// prend un snapshot des zValues
foreach(QGraphicsItem *qgi, items_list) undo_hash.insert(qgi, qgi -> zValue());