Hello,

im new in progamming wie Qt, so i had try some tutorials.
One of is:

http://www.bogotobogo.com/Qt/Qt5_QGr...phicsScene.php

This is the basic of my code.

What i want to do:

On the graphics view i add two ellipse (ellipse1, ellipse2) and a line.

I change the flags of the ellipses to moveable.

So now i want that the start point of the line (x1,y2) is on the center of ellipse1 and the end point of the line (x2,y2) is at the center of ellipse2.
If one ellipse move per mouse, the line should move too.

If i add the line in this way:
Qt Code:
  1. line = scene->addLine(ellipse1->scenePos().x(),ellipse1->scenePos().y(),
  2. ellipse2->scenePos().x(),ellipse2->scenePos().y(),outlinePen);
To copy to clipboard, switch view to plain text mode 

For the scenPos() function i get 0. But i dont know why.

Did anyone has an idee ?

Thx

dialog.hdialog.cppdialog.hdialog.cpp