mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 12:40:35 +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;
|
||||
}
|
||||
if (i < 3) return(false);
|
||||
QPointF points[i-1];
|
||||
QVector<QPointF> points(i-1);
|
||||
for (int j = 1 ; j < i ; ++ j) {
|
||||
points[j-1] = QPointF(
|
||||
e.attribute(QString("x%1").arg(j)).toDouble(),
|
||||
e.attribute(QString("y%1").arg(j)).toDouble()
|
||||
points.insert(
|
||||
j - 1,
|
||||
QPointF(
|
||||
e.attribute(QString("x%1").arg(j)).toDouble(),
|
||||
e.attribute(QString("y%1").arg(j)).toDouble()
|
||||
)
|
||||
);
|
||||
}
|
||||
qp.save();
|
||||
setPainterStyle(e, qp);
|
||||
if (e.attribute("closed") == "false") qp.drawPolyline(points, i-1);
|
||||
else qp.drawPolygon(points, i-1);
|
||||
if (e.attribute("closed") == "false") qp.drawPolyline(points.data(), i-1);
|
||||
else qp.drawPolygon(points.data(), i-1);
|
||||
qp.restore();
|
||||
return(true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user