The problem scenario is below:
1. A list of polygons are displayed in the left side of the widget.
2. On the right side of the widget a preview area is there with QGraphicsView widget..
3. The user can select a polygon from the left side and the selected polygon is displayed in
the right side preview area...
4. The selected polygons are scattered at different points of QGraphicsView.
5. I require that the polygons should be drawn in correct order as you can see in the attachement AFter_Centralization.jpg.
I am adding the polygon like below
DrawPolygon(int xOffset, int yOffset)
{
for(int i=xOffset; i<10; i++)
{
for(j=yOffset; j<10; j++)
{
vctPoints.
append(QPointF(i
*50,j
*50));
}
}
polyScene->addPolygon(polygon);
ptrGraphisView->setScene(polyScene);
}
DrawPolygon(int xOffset, int yOffset)
{
QGraphicsView *ptrGraphicsView = new QGraphicsView();
QGraphicsScene *polyScene = new QGraphicsScene();
QVector <QPointF> vctPoints;
for(int i=xOffset; i<10; i++)
{
for(j=yOffset; j<10; j++)
{
vctPoints.append(QPointF(i*50,j*50));
}
}
QPolygon *polygon = new QPolygon(vctPoints);
polyScene->addPolygon(polygon);
ptrGraphisView->setScene(polyScene);
}
To copy to clipboard, switch view to plain text mode
The above function draws polygon considering different offset values... and so the polygons get scattered in the QGV...
I want to place the scattered polygons in a central axis...
Regards
Ranna
Bookmarks