Commit b36627ae authored by Ivan Ilin's avatar Ivan Ilin

Zvalue controller is now finished

parent 4d196a03
...@@ -306,9 +306,6 @@ UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy ...@@ -306,9 +306,6 @@ UBSvgSubsetAdaptor::UBSvgSubsetReader::UBSvgSubsetReader(UBDocumentProxy* pProxy
UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
{ {
UBGraphicsScene *scene = 0; UBGraphicsScene *scene = 0;
qreal maxDrawingZIndex = 0;
qreal maxObjectZIndex = 0;
UBGraphicsWidgetItem *currentWidget = 0; UBGraphicsWidgetItem *currentWidget = 0;
mFileVersion = 40100; // default to 4.1.0 mFileVersion = 40100; // default to 4.1.0
...@@ -481,7 +478,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -481,7 +478,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene->addItem(polygonItem); scene->addItem(polygonItem);
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
maxDrawingZIndex = qMax(polygonItem->zValue(), maxDrawingZIndex);
polygonItem->show(); polygonItem->show();
} }
...@@ -501,8 +497,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -501,8 +497,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
scene->addItem(polygonItem); scene->addItem(polygonItem);
polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic)); polygonItem->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Graphic));
maxDrawingZIndex = qMax(polygonItem->zValue(), maxDrawingZIndex);
polygonItem->show(); polygonItem->show();
} }
} }
...@@ -527,8 +521,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -527,8 +521,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
maxObjectZIndex = qMax(pixmapItem->zValue(), maxObjectZIndex);
scene->addItem(pixmapItem); scene->addItem(pixmapItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -549,8 +541,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -549,8 +541,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
svgItem->setFlag(QGraphicsItem::ItemIsMovable, true); svgItem->setFlag(QGraphicsItem::ItemIsMovable, true);
svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true); svgItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
maxObjectZIndex = qMax(svgItem->zValue(), maxObjectZIndex);
scene->addItem(svgItem); scene->addItem(svgItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -577,8 +567,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -577,8 +567,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
audioItem->setFlag(QGraphicsItem::ItemIsMovable, true); audioItem->setFlag(QGraphicsItem::ItemIsMovable, true);
audioItem->setFlag(QGraphicsItem::ItemIsSelectable, true); audioItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
maxObjectZIndex = qMax(audioItem->zValue(), maxObjectZIndex);
scene->addItem(audioItem); scene->addItem(audioItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -600,8 +588,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -600,8 +588,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
videoItem->setFlag(QGraphicsItem::ItemIsMovable, true); videoItem->setFlag(QGraphicsItem::ItemIsMovable, true);
videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true); videoItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
maxObjectZIndex = qMax(videoItem->zValue(), maxObjectZIndex);
scene->addItem(videoItem); scene->addItem(videoItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -623,8 +609,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -623,8 +609,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
textItem->setFlag(QGraphicsItem::ItemIsMovable, true); textItem->setFlag(QGraphicsItem::ItemIsMovable, true);
textItem->setFlag(QGraphicsItem::ItemIsSelectable, true); textItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
maxObjectZIndex = qMax(textItem->zValue(), maxObjectZIndex);
scene->addItem(textItem); scene->addItem(textItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -733,8 +717,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -733,8 +717,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true); pdfItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pdfItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pdfItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
maxObjectZIndex = qMax(pdfItem->zValue(), maxObjectZIndex);
scene->addItem(pdfItem); scene->addItem(pdfItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -758,8 +740,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -758,8 +740,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
appleWidgetItem->resize(foreignObjectWidth, foreignObjectHeight); appleWidgetItem->resize(foreignObjectWidth, foreignObjectHeight);
maxObjectZIndex = qMax(appleWidgetItem->zValue(), maxObjectZIndex);
scene->addItem(appleWidgetItem); scene->addItem(appleWidgetItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -781,8 +761,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -781,8 +761,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
w3cWidgetItem->resize(foreignObjectWidth, foreignObjectHeight); w3cWidgetItem->resize(foreignObjectWidth, foreignObjectHeight);
maxObjectZIndex = qMax(w3cWidgetItem->zValue(), maxObjectZIndex);
scene->addItem(w3cWidgetItem); scene->addItem(w3cWidgetItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -802,7 +780,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -802,7 +780,6 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
textItem->setFlag(QGraphicsItem::ItemIsMovable, true); textItem->setFlag(QGraphicsItem::ItemIsMovable, true);
textItem->setFlag(QGraphicsItem::ItemIsSelectable, true); textItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
maxObjectZIndex = qMax(textItem->zValue(), maxObjectZIndex);
scene->addItem(textItem); scene->addItem(textItem);
if (zFromSvg != UBZLayerController::errorNum()) if (zFromSvg != UBZLayerController::errorNum())
...@@ -856,17 +833,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene() ...@@ -856,17 +833,14 @@ UBGraphicsScene* UBSvgSubsetAdaptor::UBSvgSubsetReader::loadScene()
qWarning() << "error parsing Sankore file " << mXmlReader.errorString(); qWarning() << "error parsing Sankore file " << mXmlReader.errorString();
} }
if (scene) if (scene) {
{
scene->setObjectZIndex(maxObjectZIndex);
scene->setDrawingZIndex(maxDrawingZIndex);
scene->setModified(false); scene->setModified(false);
} }
if (annotationGroup) if (annotationGroup)
{ {
if (annotationGroup->polygons().empty()) if (annotationGroup->polygons().empty())
delete annotationGroup; delete annotationGroup;
} }
return scene; return scene;
...@@ -1400,12 +1374,10 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol ...@@ -1400,12 +1374,10 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromPol
if (!ubZValue.isNull()) if (!ubZValue.isNull())
{ {
// polygonItem->setZValue (ubZValue.toString().toFloat());
UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat()); UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat());
} }
else else
{ {
// polygonItem->setZValue(mGroupZIndex);
UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex); UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex);
} }
...@@ -1509,12 +1481,10 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin ...@@ -1509,12 +1481,10 @@ UBGraphicsPolygonItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItemFromLin
if (!ubZValue.isNull()) if (!ubZValue.isNull())
{ {
// polygonItem->setZValue(ubZValue.toString().toFloat());
UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat()); UBGraphicsItem::assignZValue(polygonItem, ubZValue.toString().toFloat());
} }
else else
{ {
// polygonItem->setZValue(mGroupZIndex);
UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex); UBGraphicsItem::assignZValue(polygonItem, mGroupZIndex);
} }
...@@ -1663,7 +1633,6 @@ QList<UBGraphicsPolygonItem*> UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItem ...@@ -1663,7 +1633,6 @@ QList<UBGraphicsPolygonItem*> UBSvgSubsetAdaptor::UBSvgSubsetReader::polygonItem
{ {
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(QLineF(points.at(i), points.at(i + 1)), lineWidth); UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(QLineF(points.at(i), points.at(i + 1)), lineWidth);
polygonItem->setColor(brushColor); polygonItem->setColor(brushColor);
// polygonItem->setZValue(zValue);
UBGraphicsItem::assignZValue(polygonItem, zValue); UBGraphicsItem::assignZValue(polygonItem, zValue);
polygonItem->setColorOnDarkBackground(colorOnDarkBackground); polygonItem->setColorOnDarkBackground(colorOnDarkBackground);
polygonItem->setColorOnLightBackground(colorOnLightBackground); polygonItem->setColorOnLightBackground(colorOnLightBackground);
...@@ -2008,7 +1977,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g ...@@ -2008,7 +1977,6 @@ void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* g
if (!ubZValue.isNull()) if (!ubZValue.isNull())
{ {
// gItem->setZValue(ubZValue.toString().toFloat());
UBGraphicsItem::assignZValue(gItem, ubZValue.toString().toFloat()); UBGraphicsItem::assignZValue(gItem, ubZValue.toString().toFloat());
} }
...@@ -2591,7 +2559,6 @@ UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg() ...@@ -2591,7 +2559,6 @@ UBGraphicsRuler* UBSvgSubsetAdaptor::UBSvgSubsetReader::rulerFromSvg()
graphicsItemFromSvg(ruler); graphicsItemFromSvg(ruler);
// ruler->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler);
UBGraphicsItem::assignZValue(ruler, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler); UBGraphicsItem::assignZValue(ruler, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetRuler);
ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); ruler->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
...@@ -2650,7 +2617,6 @@ UBGraphicsCompass* UBSvgSubsetAdaptor::UBSvgSubsetReader::compassFromSvg() ...@@ -2650,7 +2617,6 @@ UBGraphicsCompass* UBSvgSubsetAdaptor::UBSvgSubsetReader::compassFromSvg()
graphicsItemFromSvg(compass); graphicsItemFromSvg(compass);
//compass->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass);
UBGraphicsItem::assignZValue(compass, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass); UBGraphicsItem::assignZValue(compass, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCompass);
compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); compass->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
...@@ -2715,7 +2681,6 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg() ...@@ -2715,7 +2681,6 @@ UBGraphicsProtractor* UBSvgSubsetAdaptor::UBSvgSubsetReader::protractorFromSvg()
{ {
UBGraphicsProtractor* protractor = new UBGraphicsProtractor(); UBGraphicsProtractor* protractor = new UBGraphicsProtractor();
// protractor->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor);
UBGraphicsItem::assignZValue(protractor, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor); UBGraphicsItem::assignZValue(protractor, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetProtractor);
protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); protractor->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
...@@ -2786,7 +2751,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() ...@@ -2786,7 +2751,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
{ {
UBGraphicsTriangle* triangle = new UBGraphicsTriangle(); UBGraphicsTriangle* triangle = new UBGraphicsTriangle();
// triangle->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle);
UBGraphicsItem::assignZValue(triangle, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle); UBGraphicsItem::assignZValue(triangle, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetTriangle);
triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); triangle->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
...@@ -2813,8 +2777,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg() ...@@ -2813,8 +2777,6 @@ UBGraphicsTriangle* UBSvgSubsetAdaptor::UBSvgSubsetReader::triangleFromSvg()
UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg() UBGraphicsCache* UBSvgSubsetAdaptor::UBSvgSubsetReader::cacheFromSvg()
{ {
UBGraphicsCache* pCache = new UBGraphicsCache(); UBGraphicsCache* pCache = new UBGraphicsCache();
pCache->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache);
// UBGraphicsItem::assignZValue(pCache, UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCache);
pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool)); pCache->setData(UBGraphicsItemData::ItemLayerType, QVariant(UBItemLayerType::Tool));
graphicsItemFromSvg(pCache); graphicsItemFromSvg(pCache);
......
...@@ -1943,8 +1943,6 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint ...@@ -1943,8 +1943,6 @@ void UBBoardController::processMimeData(const QMimeData* pMimeData, const QPoint
if (gi) if (gi)
{ {
// gi->setZValue(mActiveScene->getNextObjectZIndex());
UBGraphicsItem::assignZValue(gi, mActiveScene->getNextObjectZIndex());
mActiveScene->addItem(gi); mActiveScene->addItem(gi);
gi->setPos(gi->pos() + QPointF(50, 50)); gi->setPos(gi->pos() + QPointF(50, 50));
} }
......
...@@ -84,6 +84,7 @@ struct itemLayerType ...@@ -84,6 +84,7 @@ struct itemLayerType
, Curtain , Curtain
, Pointer , Pointer
, Cache , Cache
, SelectedItem
}; };
}; };
......
...@@ -97,8 +97,6 @@ UBItem* UBGraphicsAudioItem::deepCopy() const ...@@ -97,8 +97,6 @@ UBItem* UBGraphicsAudioItem::deepCopy() const
UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem()); UBGraphicsAudioItem *copy = new UBGraphicsAudioItem(audioUrl, parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -73,8 +73,6 @@ void UBGraphicsItemDelegate::init() ...@@ -73,8 +73,6 @@ void UBGraphicsItemDelegate::init()
{ {
mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio); mFrame = new UBGraphicsDelegateFrame(this, QRectF(0, 0, 0, 0), mFrameWidth, mRespectRatio);
mFrame->hide(); mFrame->hide();
// mFrame->setZValue(UBGraphicsScene::toolLayerStart + 1);
UBGraphicsItem::assignZValue(mFrame, UBGraphicsScene::toolLayerStart + 1);
mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true); mFrame->setFlag(QGraphicsItem::ItemIsSelectable, true);
mDeleteButton = new DelegateButton(":/images/close.svg", mDelegated, mFrame, Qt::TopLeftSection); mDeleteButton = new DelegateButton(":/images/close.svg", mDelegated, mFrame, Qt::TopLeftSection);
...@@ -102,8 +100,6 @@ void UBGraphicsItemDelegate::init() ...@@ -102,8 +100,6 @@ void UBGraphicsItemDelegate::init()
foreach(DelegateButton* button, mButtons) foreach(DelegateButton* button, mButtons)
{ {
button->hide(); button->hide();
// button->setZValue(UBGraphicsScene::toolLayerStart + 2);
UBGraphicsItem::assignZValue(button, UBGraphicsScene::toolLayerStart + 2);
button->setFlag(QGraphicsItem::ItemIsSelectable, true); button->setFlag(QGraphicsItem::ItemIsSelectable, true);
} }
} }
...@@ -168,18 +164,9 @@ bool UBGraphicsItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event) ...@@ -168,18 +164,9 @@ bool UBGraphicsItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *event)
if (!mDelegated->isSelected()) if (!mDelegated->isSelected())
{ {
mDelegated->setSelected(true); mDelegated->setSelected(true);
UBGraphicsScene* scene = static_cast<UBGraphicsScene*>(mDelegated->scene());
qDebug() << mDelegated->zValue(); qDebug() << mDelegated->zValue();
qDebug() << scene->currentObjectZIndex();
// To investigate. Z value behavior
// if (mDelegated->zValue() < scene->currentObjectZIndex() && !isLocked())
// mDelegated->setZValue(scene->getNextObjectZIndex());
positionHandles(); positionHandles();
return true; return true;
} }
else else
...@@ -288,6 +275,7 @@ void UBGraphicsItemDelegate::positionHandles() ...@@ -288,6 +275,7 @@ void UBGraphicsItemDelegate::positionHandles()
mDelegated->scene()->addItem(button); mDelegated->scene()->addItem(button);
} }
button->show(); button->show();
button->setZValue(delegated()->zValue());
} }
} else { } else {
foreach(DelegateButton* button, mButtons) foreach(DelegateButton* button, mButtons)
......
...@@ -33,7 +33,7 @@ class DelegateButton: public QGraphicsSvgItem ...@@ -33,7 +33,7 @@ class DelegateButton: public QGraphicsSvgItem
Q_OBJECT Q_OBJECT
public: public:
DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::NoSection) DelegateButton(const QString & fileName, QGraphicsItem* pDelegated, QGraphicsItem * parent = 0, Qt::WindowFrameSection section = Qt::TopLeftSection)
: QGraphicsSvgItem(fileName, parent) : QGraphicsSvgItem(fileName, parent)
, mDelegated(pDelegated) , mDelegated(pDelegated)
, mIsTransparentToMouseEvent(false) , mIsTransparentToMouseEvent(false)
......
...@@ -85,8 +85,6 @@ UBItem* UBGraphicsPDFItem::deepCopy() const ...@@ -85,8 +85,6 @@ UBItem* UBGraphicsPDFItem::deepCopy() const
UBGraphicsPDFItem *copy = new UBGraphicsPDFItem(mRenderer, mPageNumber, parentItem()); UBGraphicsPDFItem *copy = new UBGraphicsPDFItem(mRenderer, mPageNumber, parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
...@@ -136,8 +134,6 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const ...@@ -136,8 +134,6 @@ UBGraphicsPixmapItem* UBGraphicsPDFItem::toPixmapItem() const
pixmapItem->setPixmap(pixmap); pixmapItem->setPixmap(pixmap);
pixmapItem->setPos(this->pos()); pixmapItem->setPos(this->pos());
// pixmapItem->setZValue(this->zValue());
UBGraphicsItem::assignZValue(pixmapItem, this->zValue());
pixmapItem->setTransform(this->transform()); pixmapItem->setTransform(this->transform());
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -103,8 +103,6 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const ...@@ -103,8 +103,6 @@ UBItem* UBGraphicsPixmapItem::deepCopy() const
copy->setPixmap(this->pixmap()); copy->setPixmap(this->pixmap());
copy->setPos(this->pos()); copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -161,9 +161,6 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con ...@@ -161,9 +161,6 @@ UBGraphicsPolygonItem* UBGraphicsPolygonItem::deepCopy(const QPolygonF& pol) con
copy->setPen(this->pen()); copy->setPen(this->pen());
copy->mHasAlpha = this->mHasAlpha; copy->mHasAlpha = this->mHasAlpha;
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setColorOnDarkBackground(this->colorOnDarkBackground()); copy->setColorOnDarkBackground(this->colorOnDarkBackground());
copy->setColorOnLightBackground(this->colorOnLightBackground()); copy->setColorOnLightBackground(this->colorOnLightBackground());
......
This diff is collapsed.
...@@ -181,23 +181,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -181,23 +181,11 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
return mCrossedBackground; return mCrossedBackground;
} }
void setDrawingZIndex(qreal pDrawingZIndex)
{
mDrawingZIndex = pDrawingZIndex;
}
void setObjectZIndex(qreal pObjectZIndex)
{
mObjectZIndex = pObjectZIndex;
}
bool hasBackground() bool hasBackground()
{ {
return (mBackgroundObject != 0); return (mBackgroundObject != 0);
} }
qreal getNextObjectZIndex();
void addRuler(QPointF center); void addRuler(QPointF center);
void addProtractor(QPointF center); void addProtractor(QPointF center);
void addCompass(QPointF center); void addCompass(QPointF center);
...@@ -254,11 +242,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -254,11 +242,6 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void setNominalSize(int pWidth, int pHeight); void setNominalSize(int pWidth, int pHeight);
qreal currentObjectZIndex()
{
return mObjectZIndex;
}
enum RenderingContext enum RenderingContext
{ {
Screen = 0, NonScreen, PdfExport, Podcast Screen = 0, NonScreen, PdfExport, Podcast
...@@ -343,19 +326,17 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem ...@@ -343,19 +326,17 @@ class UBGraphicsScene: public UBCoreGraphicsScene, public UBItem
void recolorAllItems(); void recolorAllItems();
qreal getNextDrawingZIndex(); virtual void drawItems (QPainter * painter, int numItems,
virtual void drawItems (QPainter * painter, int numItems,
QGraphicsItem * items[], const QStyleOptionGraphicsItem options[], QWidget * widget = 0); QGraphicsItem * items[], const QStyleOptionGraphicsItem options[], QWidget * widget = 0);
QGraphicsItem* rootItem(QGraphicsItem* item) const; QGraphicsItem* rootItem(QGraphicsItem* item) const;
private: private:
void setDocumentUpdated(); void setDocumentUpdated();
qreal generateZLevel(QGraphicsItem *item); void createEraiser();
void createPointer();
qreal mDrawingZIndex; qreal generateZLevel(QGraphicsItem *item);
qreal mObjectZIndex;
QGraphicsEllipseItem* mEraser; QGraphicsEllipseItem* mEraser;
QGraphicsEllipseItem* mPointer; QGraphicsEllipseItem* mPointer;
......
...@@ -46,8 +46,6 @@ UBGraphicsSvgItem::UBGraphicsSvgItem(const QByteArray& pFileData, QGraphicsItem* ...@@ -46,8 +46,6 @@ UBGraphicsSvgItem::UBGraphicsSvgItem(const QByteArray& pFileData, QGraphicsItem*
setSharedRenderer(renderer); setSharedRenderer(renderer);
mFileData = pFileData; mFileData = pFileData;
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
} }
...@@ -62,6 +60,8 @@ void UBGraphicsSvgItem::init() ...@@ -62,6 +60,8 @@ void UBGraphicsSvgItem::init()
setCacheMode(QGraphicsItem::DeviceCoordinateCache); setCacheMode(QGraphicsItem::DeviceCoordinateCache);
setMaximumCacheSize(boundingRect().size().toSize() * UB_MAX_ZOOM); setMaximumCacheSize(boundingRect().size().toSize() * UB_MAX_ZOOM);
setData(UBGraphicsItemData::itemLayerType, QVariant(itemLayerType::ObjectItem)); //Necessary to set if we want z value to be assigned correctly
} }
...@@ -133,8 +133,6 @@ UBItem* UBGraphicsSvgItem::deepCopy() const ...@@ -133,8 +133,6 @@ UBItem* UBGraphicsSvgItem::deepCopy() const
UBGraphicsSvgItem* copy = new UBGraphicsSvgItem(this->fileData()); UBGraphicsSvgItem* copy = new UBGraphicsSvgItem(this->fileData());
copy->setPos(this->pos()); copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
...@@ -188,8 +186,6 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const ...@@ -188,8 +186,6 @@ UBGraphicsPixmapItem* UBGraphicsSvgItem::toPixmapItem() const
pixmapItem->setPixmap(QPixmap::fromImage(image)); pixmapItem->setPixmap(QPixmap::fromImage(image));
pixmapItem->setPos(this->pos()); pixmapItem->setPos(this->pos());
// pixmapItem->setZValue(this->zValue());
UBGraphicsItem::assignZValue(pixmapItem, this->zValue());
pixmapItem->setTransform(this->transform()); pixmapItem->setTransform(this->transform());
pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsMovable, true);
pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true); pixmapItem->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -193,8 +193,6 @@ UBItem* UBGraphicsTextItem::deepCopy() const ...@@ -193,8 +193,6 @@ UBItem* UBGraphicsTextItem::deepCopy() const
copy->setHtml(toHtml()); copy->setHtml(toHtml());
copy->setPos(this->pos()); copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -70,8 +70,6 @@ UBItem* UBGraphicsVideoItem::deepCopy() const ...@@ -70,8 +70,6 @@ UBItem* UBGraphicsVideoItem::deepCopy() const
UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem()); UBGraphicsVideoItem *copy = new UBGraphicsVideoItem(videoUrl, parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -52,8 +52,7 @@ void UBGraphicsVideoItemDelegate::buildButtons() ...@@ -52,8 +52,7 @@ void UBGraphicsVideoItemDelegate::buildButtons()
mMuteButton->hide(); mMuteButton->hide();
mVideoControl = new DelegateVideoControl(delegated(), mFrame); mVideoControl = new DelegateVideoControl(delegated(), mFrame);
// mVideoControl->setZValue(UBGraphicsScene::toolLayerStart + 2); UBGraphicsItem::assignZValue(mVideoControl, delegated()->zValue());
UBGraphicsItem::assignZValue(mVideoControl, UBGraphicsScene::toolLayerStart + 2);
mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true); mVideoControl->setFlag(QGraphicsItem::ItemIsSelectable, true);
connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause())); connect(mPlayPauseButton, SIGNAL(clicked(bool)), this, SLOT(togglePlayPause()));
...@@ -106,6 +105,7 @@ void UBGraphicsVideoItemDelegate::positionHandles() ...@@ -106,6 +105,7 @@ void UBGraphicsVideoItemDelegate::positionHandles()
} }
mVideoControl->setAntiScale(mAntiScaleRatio); mVideoControl->setAntiScale(mAntiScaleRatio);
mVideoControl->setZValue(delegated()->zValue());
mVideoControl->show(); mVideoControl->show();
} }
else else
......
...@@ -411,7 +411,6 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const ...@@ -411,7 +411,6 @@ UBItem* UBGraphicsW3CWidgetItem::deepCopy() const
UBGraphicsW3CWidgetItem *copy = new UBGraphicsW3CWidgetItem(mWebKitWidget->widgetUrl(), parentItem()); UBGraphicsW3CWidgetItem *copy = new UBGraphicsW3CWidgetItem(mWebKitWidget->widgetUrl(), parentItem());
copy->setPos(this->pos()); copy->setPos(this->pos());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -47,8 +47,6 @@ UBItem* UBGraphicsCache::deepCopy() const ...@@ -47,8 +47,6 @@ UBItem* UBGraphicsCache::deepCopy() const
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setRect(this->rect()); copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ? // TODO UB 4.7 ... complete all members ?
......
...@@ -87,8 +87,6 @@ UBItem* UBGraphicsCompass::deepCopy() const ...@@ -87,8 +87,6 @@ UBItem* UBGraphicsCompass::deepCopy() const
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setRect(this->rect()); copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ? // TODO UB 4.7 ... complete all members ?
......
...@@ -60,8 +60,6 @@ UBGraphicsCurtainItem::~UBGraphicsCurtainItem() ...@@ -60,8 +60,6 @@ UBGraphicsCurtainItem::~UBGraphicsCurtainItem()
QVariant UBGraphicsCurtainItem::itemChange(GraphicsItemChange change, const QVariant &value) QVariant UBGraphicsCurtainItem::itemChange(GraphicsItemChange change, const QVariant &value)
{ {
// if (change == QGraphicsItem::ItemSelectedHasChanged && QGraphicsRectItem::scene() && isSelected())
// setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain);
QVariant newValue = value; QVariant newValue = value;
...@@ -133,8 +131,6 @@ UBItem* UBGraphicsCurtainItem::deepCopy() const ...@@ -133,8 +131,6 @@ UBItem* UBGraphicsCurtainItem::deepCopy() const
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setBrush(this->brush()); copy->setBrush(this->brush());
copy->setPen(this->pen()); copy->setPen(this->pen());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->setFlag(QGraphicsItem::ItemIsMovable, true); copy->setFlag(QGraphicsItem::ItemIsMovable, true);
copy->setFlag(QGraphicsItem::ItemIsSelectable, true); copy->setFlag(QGraphicsItem::ItemIsSelectable, true);
......
...@@ -52,7 +52,6 @@ bool UBGraphicsCurtainItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *ev ...@@ -52,7 +52,6 @@ bool UBGraphicsCurtainItemDelegate::mousePressEvent(QGraphicsSceneMouseEvent *ev
if (!mDelegated->isSelected()) if (!mDelegated->isSelected())
{ {
mDelegated->setSelected(true); mDelegated->setSelected(true);
// mDelegated->setZValue(UBGraphicsScene::toolLayerStart + UBGraphicsScene::toolOffsetCurtain);
positionHandles(); positionHandles();
return true; return true;
......
...@@ -581,8 +581,6 @@ UBItem* UBGraphicsProtractor::deepCopy() const ...@@ -581,8 +581,6 @@ UBItem* UBGraphicsProtractor::deepCopy() const
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setRect(this->rect()); copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
copy->mCurrentAngle = this->mCurrentAngle; copy->mCurrentAngle = this->mCurrentAngle;
......
...@@ -76,8 +76,6 @@ UBItem* UBGraphicsRuler::deepCopy() const ...@@ -76,8 +76,6 @@ UBItem* UBGraphicsRuler::deepCopy() const
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setRect(this->rect()); copy->setRect(this->rect());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ? // TODO UB 4.7 ... complete all members ?
......
...@@ -95,8 +95,6 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const ...@@ -95,8 +95,6 @@ UBItem* UBGraphicsTriangle::deepCopy(void) const
copy->setPos(this->pos()); copy->setPos(this->pos());
copy->setPolygon(this->polygon()); copy->setPolygon(this->polygon());
// copy->setZValue(this->zValue());
UBGraphicsItem::assignZValue(copy, this->zValue());
copy->setTransform(this->transform()); copy->setTransform(this->transform());
// TODO UB 4.7 ... complete all members ? // TODO UB 4.7 ... complete all members ?
......
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