-1

I’m having a scene with (0, 0, 2000, 2000) coordinated as a rectangle. now I just want to plot some points on the scene like graph coordinates

like (-x, +y , +x, -y) of the item on the scene .

consider of having a Cartesian coordinate points xMin, xMax, yMin, yMax so I made it as QGraphicsPolyGonItem . but I don’t know how to add it to the scene as a graph coordinate point on the scene.

Wagmare
  • 1,354
  • 1
  • 24
  • 58

1 Answers1

0

A scene is defined by a QRect (see its constructor). So, if you define your scene like that:

QGraphicsScene scene( -1000, -1000, 2000, 2000 );
QGraphicsView view;
view.setScene( scene );
QGraphicsRectItem* it = new QGraphicsRectItem( -10, -10, 20, 20)
scene.addItem( it ); // draw a rectangle
it.setPos( 0, 0 ); // Move to (0;0) and at the center of the view

You can have coordinates between (-1000 ; -1000) and (1000 ; 1000).

Dimitry Ernot
  • 6,256
  • 2
  • 25
  • 37
  • first thx for ur reply .. but its like changing the coordinates of QGraphicsScene .. my need is to map the item according to the scene coordinates. to be clear .. can i map a Cartesian coordinate points to a normal of 0, 0, 2000, 2000 .. please help me .. – Wagmare Apr 08 '13 at 10:40