mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Removed array intialized with a dynamic length at run-time.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1545 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -511,17 +511,20 @@ bool CustomElement::parsePolygon(QDomElement &e, QPainter &qp) {
|
|||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
if (i < 3) return(false);
|
if (i < 3) return(false);
|
||||||
QPointF points[i-1];
|
QVector<QPointF> points(i-1);
|
||||||
for (int j = 1 ; j < i ; ++ j) {
|
for (int j = 1 ; j < i ; ++ j) {
|
||||||
points[j-1] = QPointF(
|
points.insert(
|
||||||
e.attribute(QString("x%1").arg(j)).toDouble(),
|
j - 1,
|
||||||
e.attribute(QString("y%1").arg(j)).toDouble()
|
QPointF(
|
||||||
|
e.attribute(QString("x%1").arg(j)).toDouble(),
|
||||||
|
e.attribute(QString("y%1").arg(j)).toDouble()
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
qp.save();
|
qp.save();
|
||||||
setPainterStyle(e, qp);
|
setPainterStyle(e, qp);
|
||||||
if (e.attribute("closed") == "false") qp.drawPolyline(points, i-1);
|
if (e.attribute("closed") == "false") qp.drawPolyline(points.data(), i-1);
|
||||||
else qp.drawPolygon(points, i-1);
|
else qp.drawPolygon(points.data(), i-1);
|
||||||
qp.restore();
|
qp.restore();
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user