Commit 019895ed authored by Craig Watson's avatar Craig Watson

Fix issue #12 (zOrder not saved to .svg)

(Merge branch 'craig-dev' into dev)
parents 5a1468a7 64002a17
...@@ -1077,20 +1077,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1077,20 +1077,6 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
{ {
QGraphicsItem *item = items.takeFirst(); QGraphicsItem *item = items.takeFirst();
// Is the item a strokes group?
UBGraphicsStrokesGroup* strokesGroupItem = qgraphicsitem_cast<UBGraphicsStrokesGroup*>(item);
if(strokesGroupItem && strokesGroupItem->isVisible()){
// Add the polygons
foreach(QGraphicsItem* item, strokesGroupItem->childItems()){
UBGraphicsPolygonItem* poly = qgraphicsitem_cast<UBGraphicsPolygonItem*>(item);
if(NULL != poly){
polygonItemToSvgPolygon(poly, true);
items.removeOne(poly);
}
}
}
// Is the item a polygon? // Is the item a polygon?
UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item); UBGraphicsPolygonItem *polygonItem = qgraphicsitem_cast<UBGraphicsPolygonItem*> (item);
if (polygonItem && polygonItem->isVisible()) if (polygonItem && polygonItem->isVisible())
...@@ -1125,7 +1111,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) ...@@ -1125,7 +1111,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex)
if (colorOnDarkBackground.isValid() && colorOnLightBackground.isValid()) if (colorOnDarkBackground.isValid() && colorOnLightBackground.isValid())
{ {
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value" mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value"
, QString("%1").arg(polygonItem->zValue())); , QString("%1").arg(polygonItem->strokesGroup()->zValue()));
mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri
, "fill-on-dark-background", colorOnDarkBackground.name()); , "fill-on-dark-background", colorOnDarkBackground.name());
...@@ -2112,6 +2098,7 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::videoItemFromSvg() ...@@ -2112,6 +2098,7 @@ UBGraphicsMediaItem* UBSvgSubsetAdaptor::UBSvgSubsetReader::videoItemFromSvg()
void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* gItem) void UBSvgSubsetAdaptor::UBSvgSubsetReader::graphicsItemFromSvg(QGraphicsItem* gItem)
{ {
// TODO: check position
QStringRef svgTransform = mXmlReader.attributes().value("transform"); QStringRef svgTransform = mXmlReader.attributes().value("transform");
QMatrix itemMatrix; QMatrix itemMatrix;
......
...@@ -1083,7 +1083,6 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event) ...@@ -1083,7 +1083,6 @@ void UBBoardView::mouseMoveEvent (QMouseEvent *event)
// QTime mouseMoveTime = QTime::currentTime(); // QTime mouseMoveTime = QTime::currentTime();
if(!mIsDragInProgress && ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())) { if(!mIsDragInProgress && ((mapToScene(event->pos()) - mLastPressedMousePos).manhattanLength() < QApplication::startDragDistance())) {
qDebug() << "mouse move event canceled";
return; return;
} }
......
...@@ -275,6 +275,8 @@ void UBGraphicsMediaItem::copyItemParameters(UBItem *copy) const ...@@ -275,6 +275,8 @@ void UBGraphicsMediaItem::copyItemParameters(UBItem *copy) const
cp->setSourceUrl(this->sourceUrl()); cp->setSourceUrl(this->sourceUrl());
cp->resize(this->size()); cp->resize(this->size());
cp->setZValue(this->zValue());
connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), cp, SLOT(activeSceneChanged())); connect(UBApplication::boardController, SIGNAL(activeSceneChanged()), cp, SLOT(activeSceneChanged()));
// TODO UB 4.7 complete all members // TODO UB 4.7 complete all members
} }
......
...@@ -122,6 +122,7 @@ void UBGraphicsPDFItem::copyItemParameters(UBItem *copy) const ...@@ -122,6 +122,7 @@ void UBGraphicsPDFItem::copyItemParameters(UBItem *copy) const
cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setFlag(QGraphicsItem::ItemIsSelectable, true);
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));
cp->setSourceUrl(this->sourceUrl()); cp->setSourceUrl(this->sourceUrl());
cp->setZValue(this->zValue());
} }
} }
......
...@@ -156,6 +156,8 @@ void UBGraphicsPixmapItem::copyItemParameters(UBItem *copy) const ...@@ -156,6 +156,8 @@ void UBGraphicsPixmapItem::copyItemParameters(UBItem *copy) const
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));
cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked)); cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked));
cp->setSourceUrl(this->sourceUrl()); cp->setSourceUrl(this->sourceUrl());
cp->setZValue(this->zValue());
} }
} }
......
...@@ -197,6 +197,7 @@ void UBGraphicsPolygonItem::copyItemParameters(UBItem *copy) const ...@@ -197,6 +197,7 @@ void UBGraphicsPolygonItem::copyItemParameters(UBItem *copy) const
cp->setColorOnDarkBackground(this->colorOnDarkBackground()); cp->setColorOnDarkBackground(this->colorOnDarkBackground());
cp->setColorOnLightBackground(this->colorOnLightBackground()); cp->setColorOnLightBackground(this->colorOnLightBackground());
cp->setZValue(this->zValue());
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));
} }
} }
......
...@@ -262,6 +262,10 @@ qreal UBZLayerController::changeZLevelTo(QGraphicsItem *item, moveDestination de ...@@ -262,6 +262,10 @@ qreal UBZLayerController::changeZLevelTo(QGraphicsItem *item, moveDestination de
} }
//Return new z value assigned to item //Return new z value assigned to item
// experimental
item->setZValue(item->data(UBGraphicsItemData::ItemOwnZValue).toReal());
return item->data(UBGraphicsItemData::ItemOwnZValue).toReal(); return item->data(UBGraphicsItemData::ItemOwnZValue).toReal();
} }
......
...@@ -185,6 +185,7 @@ void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const ...@@ -185,6 +185,7 @@ void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const
cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setFlag(QGraphicsItem::ItemIsSelectable, true);
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));
cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked)); cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked));
cp->setZValue(this->zValue());
} }
} }
......
...@@ -180,6 +180,7 @@ void UBGraphicsSvgItem::copyItemParameters(UBItem *copy) const ...@@ -180,6 +180,7 @@ void UBGraphicsSvgItem::copyItemParameters(UBItem *copy) const
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));
cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked)); cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked));
cp->setSourceUrl(this->sourceUrl()); cp->setSourceUrl(this->sourceUrl());
cp->setZValue(this->zValue());
} }
} }
......
...@@ -280,6 +280,7 @@ void UBGraphicsTextItem::copyItemParameters(UBItem *copy) const ...@@ -280,6 +280,7 @@ void UBGraphicsTextItem::copyItemParameters(UBItem *copy) const
cp->setTextHeight(this->textHeight()); cp->setTextHeight(this->textHeight());
cp->setSourceUrl(this->sourceUrl()); cp->setSourceUrl(this->sourceUrl());
cp->setZValue(this->zValue());
} }
} }
......
...@@ -744,6 +744,7 @@ void UBGraphicsAppleWidgetItem::copyItemParameters(UBItem *copy) const ...@@ -744,6 +744,7 @@ void UBGraphicsAppleWidgetItem::copyItemParameters(UBItem *copy) const
} }
cp->setSourceUrl(this->sourceUrl()); cp->setSourceUrl(this->sourceUrl());
cp->setZValue(this->zValue());
} }
} }
...@@ -1228,6 +1229,8 @@ void UBGraphicsW3CWidgetItem::copyItemParameters(UBItem *copy) const ...@@ -1228,6 +1229,8 @@ void UBGraphicsW3CWidgetItem::copyItemParameters(UBItem *copy) const
{ {
cp->setDatastoreEntry(key, mDatastore.value(key)); cp->setDatastoreEntry(key, mDatastore.value(key));
} }
cp->setZValue(this->zValue());
} }
} }
...@@ -243,9 +243,6 @@ void UBSelectionFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent */*event*/) ...@@ -243,9 +243,6 @@ void UBSelectionFrame::mouseReleaseEvent(QGraphicsSceneMouseEvent */*event*/)
void UBSelectionFrame::onZoomChanged(qreal pZoom) void UBSelectionFrame::onZoomChanged(qreal pZoom)
{ {
qDebug() << "Pzoom" << pZoom;
qDebug() << "Board current zoom" << UBApplication::boardController->currentZoom();
qDebug() << "UBApplication::boardController->systemScaleFactor()" << UBApplication::boardController->systemScaleFactor();
mAntiscaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * pZoom); mAntiscaleRatio = 1 / (UBApplication::boardController->systemScaleFactor() * pZoom);
} }
...@@ -458,7 +455,6 @@ QList<QGraphicsItem*> UBSelectionFrame::sortedByZ(const QList<QGraphicsItem *> & ...@@ -458,7 +455,6 @@ QList<QGraphicsItem*> UBSelectionFrame::sortedByZ(const QList<QGraphicsItem *> &
QList<DelegateButton*> UBSelectionFrame::buttonsForFlags(UBGraphicsFlags fls) { QList<DelegateButton*> UBSelectionFrame::buttonsForFlags(UBGraphicsFlags fls) {
qDebug() << "buttons for flags" << QString::number((int)fls, 2);
QList<DelegateButton*> result; QList<DelegateButton*> result;
if (!mDeleteButton) { if (!mDeleteButton) {
......
...@@ -167,6 +167,7 @@ void UBGraphicsCurtainItem::copyItemParameters(UBItem *copy) const ...@@ -167,6 +167,7 @@ void UBGraphicsCurtainItem::copyItemParameters(UBItem *copy) const
cp->setFlag(QGraphicsItem::ItemIsMovable, true); cp->setFlag(QGraphicsItem::ItemIsMovable, true);
cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setFlag(QGraphicsItem::ItemIsSelectable, true);
cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType));
cp->setZValue(this->zValue());
} }
} }
......
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