From 4d74341c689ffad7644c88127f845ea59eb0581a Mon Sep 17 00:00:00 2001 From: Craig Watson Date: Wed, 9 Dec 2015 12:12:01 +0100 Subject: [PATCH] Fixed pen strokes' zLevels not being saved to file (Issue #12) --- src/adaptors/UBSvgSubsetAdaptor.cpp | 2 +- src/domain/UBGraphicsScene.cpp | 4 ++++ src/domain/UBGraphicsStrokesGroup.cpp | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/adaptors/UBSvgSubsetAdaptor.cpp b/src/adaptors/UBSvgSubsetAdaptor.cpp index 2ba03817..bfd1a0b0 100644 --- a/src/adaptors/UBSvgSubsetAdaptor.cpp +++ b/src/adaptors/UBSvgSubsetAdaptor.cpp @@ -1111,7 +1111,7 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene(int pageIndex) if (colorOnDarkBackground.isValid() && colorOnLightBackground.isValid()) { mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri, "z-value" - , QString("%1").arg(polygonItem->zValue())); + , QString("%1").arg(polygonItem->strokesGroup()->zValue())); mXmlWriter.writeAttribute(UBSettings::uniboardDocumentNamespaceUri , "fill-on-dark-background", colorOnDarkBackground.name()); diff --git a/src/domain/UBGraphicsScene.cpp b/src/domain/UBGraphicsScene.cpp index 63197044..a9acebbd 100644 --- a/src/domain/UBGraphicsScene.cpp +++ b/src/domain/UBGraphicsScene.cpp @@ -262,6 +262,10 @@ qreal UBZLayerController::changeZLevelTo(QGraphicsItem *item, moveDestination de } //Return new z value assigned to item + + // experimental + item->setZValue(item->data(UBGraphicsItemData::ItemOwnZValue).toReal()); + return item->data(UBGraphicsItemData::ItemOwnZValue).toReal(); } diff --git a/src/domain/UBGraphicsStrokesGroup.cpp b/src/domain/UBGraphicsStrokesGroup.cpp index b7eb51c3..e5aa0884 100644 --- a/src/domain/UBGraphicsStrokesGroup.cpp +++ b/src/domain/UBGraphicsStrokesGroup.cpp @@ -185,6 +185,7 @@ void UBGraphicsStrokesGroup::copyItemParameters(UBItem *copy) const cp->setFlag(QGraphicsItem::ItemIsSelectable, true); cp->setData(UBGraphicsItemData::ItemLayerType, this->data(UBGraphicsItemData::ItemLayerType)); cp->setData(UBGraphicsItemData::ItemLocked, this->data(UBGraphicsItemData::ItemLocked)); + cp->setZValue(this->zValue()); } }