Commit 31ca9eca authored by Ivan Ilin's avatar Ivan Ilin

not stable changes

parent c9d41663
...@@ -93,8 +93,8 @@ void UBGraphicsItemDelegate::init() ...@@ -93,8 +93,8 @@ void UBGraphicsItemDelegate::init()
foreach(DelegateButton* button, mButtons) foreach(DelegateButton* button, mButtons)
{ {
button->hide(); button->hide();
// button->setZValue(UBGraphicsScene::toolLayerStart + 2); button->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2); // UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2);
button->setFlag(QGraphicsItem::ItemIsSelectable, true); button->setFlag(QGraphicsItem::ItemIsSelectable, true);
} }
} }
......
...@@ -50,7 +50,7 @@ void UBGraphicsItemTransformUndoCommand::undo() ...@@ -50,7 +50,7 @@ void UBGraphicsItemTransformUndoCommand::undo()
mItem->setPos(mPreviousPosition); mItem->setPos(mPreviousPosition);
mItem->setTransform(mPreviousTransform); mItem->setTransform(mPreviousTransform);
// mItem->setZValue(mPreviousZValue); // mItem->setZValue(mPreviousZValue);
UBGraphicsItem::assignZValue(mItem, mPreviousZValue); // UBGraphicsItem::assignZValue(mItem, mPreviousZValue);
UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem); UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem);
...@@ -63,7 +63,8 @@ void UBGraphicsItemTransformUndoCommand::redo() ...@@ -63,7 +63,8 @@ void UBGraphicsItemTransformUndoCommand::redo()
mItem->setPos(mCurrentPosition); mItem->setPos(mCurrentPosition);
mItem->setTransform(mCurrentTransform); mItem->setTransform(mCurrentTransform);
// mItem->setZValue(mCurrentZValue); // mItem->setZValue(mCurrentZValue);
UBGraphicsItem::assignZValue(mItem, mCurrentZValue);
UBGraphicsItem::assignZValue(mItem, /*mCurrentZValue*/mItem->data(UBGraphicsItemData::ItemOwnZValue).toReal());
UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem); UBResizableGraphicsItem* resizableItem = dynamic_cast<UBResizableGraphicsItem*>(mItem);
......
...@@ -60,6 +60,7 @@ ...@@ -60,6 +60,7 @@
#include "UBGraphicsStroke.h" #include "UBGraphicsStroke.h"
#include "core/memcheck.h" #include "core/memcheck.h"
#include "qtlogger.h"
qreal UBGraphicsScene::backgroundLayerStart = -20000000.0; qreal UBGraphicsScene::backgroundLayerStart = -20000000.0;
qreal UBGraphicsScene::objectLayerStart = -10000000.0; qreal UBGraphicsScene::objectLayerStart = -10000000.0;
...@@ -139,6 +140,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent) ...@@ -139,6 +140,8 @@ UBGraphicsScene::UBGraphicsScene(UBDocumentProxy* parent)
} }
connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing())); connect(this, SIGNAL(selectionChanged()), this, SLOT(selectionChangedProcessing()));
QtLogger::logger().start("/home/ilia/Documents/tmp/2/log.txt");
QtLogger::logger().finish();
} }
UBGraphicsScene::~UBGraphicsScene() UBGraphicsScene::~UBGraphicsScene()
...@@ -152,12 +155,15 @@ UBGraphicsScene::~UBGraphicsScene() ...@@ -152,12 +155,15 @@ UBGraphicsScene::~UBGraphicsScene()
void UBGraphicsScene::selectionChangedProcessing() void UBGraphicsScene::selectionChangedProcessing()
{ {
QtLogger::logger().start("/home/ilia/Documents/tmp/2/log.txt");
QtLogger::logger() << "selection processing started\n" << endl;
// if (selectedItems().count()) if (selectedItems().count())
// UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f')); UBApplication::showMessage("ZValue is " + QString::number(selectedItems().first()->zValue(), 'f'));
QList<QGraphicsItem *> allItemsList = items(); QList<QGraphicsItem *> allItemsList = items();
QtLogger::logger() << "=====all items searching...======" << endl;
for( int i = 0; i < allItemsList.size(); i++ ) for( int i = 0; i < allItemsList.size(); i++ )
{ {
QGraphicsItem *nextItem = allItemsList.at(i); QGraphicsItem *nextItem = allItemsList.at(i);
...@@ -167,18 +173,27 @@ void UBGraphicsScene::selectionChangedProcessing() ...@@ -167,18 +173,27 @@ void UBGraphicsScene::selectionChangedProcessing()
continue; continue;
//Temporary stub end (sankore 360) //Temporary stub end (sankore 360)
// qreal zValue = nextItem->zValue(); // 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); // qDebug() << QString(" %1 ").arg(i) << QString(" %1 ").arg(zValue);
} }
QList<QGraphicsItem *> selItemsList = selectedItems(); QList<QGraphicsItem *> selItemsList = selectedItems();
QtLogger::logger() << "=====selected items searching...======" << endl;
QGraphicsItem *nextItem;
for( int i = 0; i < selItemsList.size(); i++ ) 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(); // qreal zValue = nextItem->zValue();
nextItem->setZValue(2); nextItem->setZValue(2);
// qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue); // qDebug() << QString(" >>> %1 <<< ").arg(i) << QString(" >>> %1 <<< ").arg(zValue);
} }
QtLogger::logger() << "\nselection processing finished" << endl;
QtLogger::logger().finish();
} }
// MARK: - // MARK: -
......
...@@ -148,8 +148,8 @@ class UBThumbnail ...@@ -148,8 +148,8 @@ class UBThumbnail
if (!mSelectionItem->scene()) if (!mSelectionItem->scene())
{ {
item->scene()->addItem(mSelectionItem); item->scene()->addItem(mSelectionItem);
// mSelectionItem->setZValue(item->zValue() - 1); mSelectionItem->setZValue(item->zValue() - 1);
UBGraphicsItem::assignZValue(mSelectionItem, item->zValue() - 1); // UBGraphicsItem::assignZValue(mSelectionItem, item->zValue() - 1);
mAddedToScene = true; mAddedToScene = true;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment