Dawid Sip wrote:
> Hi,
> Im still working on my Polygonal Path which at the moment uses 
> QGraphicsSvgItem for Vertices. At the moment when user presses Shift the 
> DragMode for QGraphicsView turns to RubberBand. I want the ability to 
> select one, two, ..., all vertices of the MyPolygon under consideration, 
> with this Rubber Band. Since the vertices are items, this should work. 
> The only thing is, I'm not quite sure how this should work. I give you 
> the method from MyPolygon class.

...

> When I add a Vertex the first "System.out.println" is called three times 
> (?). But when I stretch the RubberBand over these items nothing happens. 
> The second "System.out.println" one is never called. Can somebody please 
> give me some tipps?

Hi Dawid,

In order for an item to be selectable, you need to set it to be 
selectable. This is done using the segFlag() or setFlags() method. By 
default an item is not selectable. For instance:

item.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsSelectable, true)

When an item is selectable you will start receiving itemChange events of 
the ItemSelected types.

The reason you are getting multiple itemChange events is because the 
itemChange function is used to notify you of a number of different 
changes, not only selection. If you print out the actual change event 
type enum, you'll see that you have things like SceneChange, 
VisibilityChange etc.

best regards,
Gunnar

_______________________________________________
Qt-jambi-interest mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest

Reply via email to