Fix saving of strokes that were partially erased

This ensures that when part of a line is erased,
`UBGraphicsStroke::isNominalLine` will no longer return true. This was
problematic as `UBSvgSubsetAdaptor` uses this to know whether or not to
save a stroke as polyline.
If it saves the stroke as a polyline, then the erased portions of the stroke
reappear after saving.

Therefore, we now force saving of the stroke as a group of polygons when it
has been partially erased.
preferencesAboutTextFull
Craig Watson 7 years ago
parent 425129ff2f
commit bec0dc0090
  1. 2
      src/domain/UBGraphicsPolygonItem.h
  2. 1
      src/domain/UBGraphicsScene.cpp

@ -109,6 +109,8 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
qreal originalWidth() { return mOriginalWidth;}
bool isNominalLine() {return mIsNominalLine;}
void setNominalLine(bool isNominalLine) { mIsNominalLine = isNominalLine; }
QColor colorOnDarkBackground() const
{
return mColorOnDarkBackground;

@ -893,6 +893,7 @@ void UBGraphicsScene::eraseLineTo(const QPointF &pEndPoint, const qreal &pWidth)
UBGraphicsPolygonItem* polygonItem = new UBGraphicsPolygonItem(intersectedPolygons[i][j], intersectedPolygonItem->parentItem());
intersectedPolygonItem->copyItemParameters(polygonItem);
polygonItem->setNominalLine(false);
polygonItem->setStroke(intersectedPolygonItem->stroke());
polygonItem->setStrokesGroup(intersectedPolygonItem->strokesGroup());
intersectedPolygonItem->strokesGroup()->addToGroup(polygonItem);

Loading…
Cancel
Save