Skip to content
Snippets Groups Projects
Commit 3926ee3c authored by Mikhail Svechnikov's avatar Mikhail Svechnikov Committed by Mikhail Svechnikov
Browse files

PolygonPointItems are in OwningVector

parent ec1c913c
No related branches found
No related tags found
1 merge request!1339GUI: fix masks and projections
......@@ -511,7 +511,7 @@ void PolygonItem::setIsClosed(bool closed)
QVector<PolygonPointItem*> PolygonItem::points() const
{
return m_points;
return QVector<PolygonPointItem*>(m_points.begin(), m_points.end());
}
void PolygonItem::addPoint(double x, double y)
......@@ -519,7 +519,7 @@ void PolygonItem::addPoint(double x, double y)
auto* pointItem = new PolygonPointItem;
pointItem->setPosX(x);
pointItem->setPosY(y);
m_points.push_back(pointItem); // TODO: check whether the order of points matter
m_points.emplace_back(pointItem); // TODO: check whether the order of points matter
}
void PolygonItem::writeTo(QXmlStreamWriter* w) const
......@@ -537,7 +537,7 @@ void PolygonItem::writeTo(QXmlStreamWriter* w) const
w->writeEndElement();
// polygon points
for (const auto* p : points()) {
for (const auto* p : m_points) {
w->writeStartElement(Tag::PolygonPoint);
p->writeTo(w);
w->writeEndElement();
......@@ -579,11 +579,6 @@ void PolygonItem::readFrom(QXmlStreamReader* r)
}
}
PolygonItem::~PolygonItem()
{
qDeleteAll(m_points); // TODO: check this!
}
/* ------------------------------------------------------------------------- */
VerticalLineItem::VerticalLineItem()
......
......@@ -118,7 +118,6 @@ private:
class PolygonItem : public MaskItem {
public:
PolygonItem();
~PolygonItem();
std::unique_ptr<IShape2D> createShape(double scale) const override;
bool isClosed() const;
......@@ -132,7 +131,7 @@ public:
private:
bool m_isClosed = false;
QVector<PolygonPointItem*> m_points;
OwningVector<PolygonPointItem> m_points;
};
class VerticalLineItem : public MaskItem {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment