int LEN = 640; QPoint arr[LEN]; for (int i = 0; i < LEN; i ++) { arr[i].rx() = i; if (315 < i && i < 320) arr[i].ry() = LEN; else if ( i % 2 == 0 || i % 3) arr[i].ry() = 20; else arr[i].ry() = 0; } arr[LEN].rx() = LEN - 1; arr[LEN].ry() = 0; arr[LEN + 1].rx() = 0; arr[LEN + 1].ry() = 0;
void paintEvent(QPaintEvent *ev){ QPainter painter(this); painter.setPen(QColor(Qt::black)); painter.setBrush(QBrush(QColor(Qt::white)));// некая трансформация QPainter... // рисование painter.drawPolygon(arr, LEN + 2);}
C++ (Qt) arr[LEN].rx() = LEN - 1; arr[LEN].ry() = 0; arr[LEN + 1].rx() = 0; arr[LEN + 1].ry() = 0;
C++ (Qt) arr[LEN].rx() = LEN - 1; // arr[640] arr[LEN].ry() = 0; // arr[640] arr[LEN + 1].rx() = 0; // arr[641] arr[LEN + 1].ry() = 0; // arr[641]
QPoint arr[LEN];
QPoint arr[LEN + 2];