How can I contact the AIS_InteractiveObject and qwidget?

Hello everyone,
I created some shapes in the view. Each shape has a number. I want to get the serial number of the shape when I put the mouse on it, but I don't know how to connect the number with the shape.
I tried to save AIS_InteractiveObject pointer when I created the shape, and use Context->SelectionManager()->Selector()->OnePicked()->Selectable() to get the pointer when mouse move. but the pointer not same.
Regards,

Kirill Gavrilov's picture

I tried to save AIS_InteractiveObject pointer when I created the shape ... but the pointer not same.

That doesn't look realistic - AIS_InteractiveContext doesn't create objects for you, the AIS_Shape displayed in Context preserves the same pointer in memory until it is destroyed.

Each shape has a number. ... I don't know how to connect the number with the shape.

Have you tried using AIS_InteractiveObject::SetOwner() interface? You may put your number as a string Handle(TCollection_HAsciiString), for instance.

zhang fan's picture

My bad.The point is covered by other shapes.
thanks.