diff --git a/src/domain/UBGraphicsItemDelegate.cpp b/src/domain/UBGraphicsItemDelegate.cpp index de335a3a..910d001c 100644 --- a/src/domain/UBGraphicsItemDelegate.cpp +++ b/src/domain/UBGraphicsItemDelegate.cpp @@ -93,8 +93,8 @@ void UBGraphicsItemDelegate::init() foreach(DelegateButton* button, mButtons) { button->hide(); -// button->setZValue(UBGraphicsScene::toolLayerStart + 2); - UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2); + button->setZValue(UBGraphicsScene::toolLayerStart + 2); +// UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2); button->setFlag(QGraphicsItem::ItemIsSelectable, true); } } diff --git a/src/domain/UBGraphicsItemTransformUndoCommand.cpp b/src/domain/UBGraphicsItemTransformUndoCommand.cpp index e56027ea..e883c8e9 100644 --- a/src/domain/UBGraphicsItemTransformUndoCommand.cpp +++ b/src/domain/UBGraphicsItemTransformUndoCommand.cpp @@ -50,7 +50,7 @@ void UBGraphicsItemTransformUndoCommand::undo() mItem->setPos(mPreviousPosition); mItem->setTransform(mPreviousTransform); // mItem->setZValue(mPreviousZValue); - UBGraphicsItem::assignZValue(mItem, mPreviousZValue); +// UBGraphicsItem::assignZValue(mItem, mPreviousZValue); UBResizableGraphicsItem* resizableItem = dynamic_cast(mItem); @@ -63,7 +63,8 @@ void UBGraphicsItemTransformUndoCommand::redo() mItem->setPos(mCurrentPosition); mItem->setTransform(mCurrentTransform); // mItem->setZValue(mCurrentZValue); - UBGraphicsItem::assignZValue(mItem, mCurrentZValue); + + UBGraphicsItem::assignZValue(mItem, /*mCurrentZValue*/mItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); UBResizableGraphicsItem* resizableItem = dynamic_cast(mItem); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index d4a7f8d8..b5a59ed8 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -60,6 +60,7 @@ #include "UBGraphicsStroke.h" #include "core/memcheck.h" +#include "qtlogger.h" qreal UBGraphicsScene::backgroundLayerStart = -20000000.0; qreal UBGraphicsScene::objectLayerStart = -10000000.0; @@ -139,6 +140,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) } connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); + QtLogger::logger().start("/home/ilia/Documents/tmp/2/log.txt"); + QtLogger::logger().finish(); } UBGraphicsScene::~UBGraphicsScene() @@ -152,12 +155,15 @@ UBGraphicsScene::~UBGraphicsScene() void UBGraphicsScene::selectionChangedProcessing() { + QtLogger::logger().start("/home/ilia/Documents/tmp/2/log.txt"); + QtLogger::logger() << "selection processing started\n" << endl; -// if (selectedItems().count()) -// UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f')); + if (selectedItems().count()) + UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f')); QList allItemsList = items(); + QtLogger::logger() << "=====all items searching...======" << endl; for( int i = 0; i < allItemsList.size(); i++ ) { QGraphicsItem *nextItem = allItemsList.at(i); @@ -167,18 +173,27 @@ void UBGraphicsScene::selectionChangedProcessing() continue; //Temporary stub end (sankore 360) // qreal zValue = nextItem->zValue(); - nextItem->setZValue(qreal(1)); +// nextItem->setZValue(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal()); + nextItem->setZValue(1); + QtLogger::logger() << "own Z " << QString::number(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f') + << " next Z " << QString::number(nextItem->zValue(), 'f')<< endl; // qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue); } - QList selItemsList = selectedItems(); + QtLogger::logger() << "=====selected items searching...======" << endl; + QGraphicsItem *nextItem; for( int i = 0; i < selItemsList.size(); i++ ) { - QGraphicsItem *nextItem = selItemsList.at(i); + nextItem = selItemsList.at(i); + QtLogger::logger() << "own Z " << QString::number(nextItem->data(UBGraphicsItemData::ItemOwnZValue).toReal(), 'f') + << " next Z " << QString::number(nextItem->zValue(), 'f')<< endl; // qreal zValue = nextItem->zValue(); nextItem->setZValue(2); // qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue); } + QtLogger::logger() << "\nselection processing finished" << endl; + QtLogger::logger().finish(); + } // MARK: - diff --git a/src/gui/UBThumbnailWidget.h b/src/gui/UBThumbnailWidget.h index 5f0543f8..f3f25d6a 100644 --- a/src/gui/UBThumbnailWidget.h +++ b/src/gui/UBThumbnailWidget.h @@ -148,8 +148,8 @@ class UBThumbnail if (!mSelectionItem->scene()) { item->scene()->addItem(mSelectionItem); -// mSelectionItem->setZValue(item->zValue() - 1); - UBGraphicsItem::assignZValue(mSelectionItem, item->zValue() - 1); + mSelectionItem->setZValue(item->zValue() - 1); +// UBGraphicsItem::assignZValue(mSelectionItem, item->zValue() - 1); mAddedToScene = true; }