For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Tooltip on an Object

prasad R's picture
Forums: 

Hi,

I am working on QT & opencascade where opencascade models are executed using QT.

In my work i need a tooltip on an object whenever a mouse over event occurs on it.

I have seen an example of QToolTip which does that in QT but I am unable to replicate the same on opencascade model.

Your help is most appreciated.

Shing Liu's picture

Hi,

I think you can get the Detected Object in the 3d viewer first, then you can show the tooltips for the detected object by your need.

The attached picture is the result of one application of mine, also used the Qt QTooltip.

Best Regards,

Shing Liu

Attachments: 
prasad R's picture

Hi Shing,

Thank you, that is what I am looking for.

As I am novice to opencascade I am unable to grasp the procedure you mentioned. If you could elaborate bit detail, it would be a great help.

warm regards,

Prasad R

Shing Liu's picture

Hello Prasad R,

I think you can set your data to the AIS_Shape by its method: SetOwner(),

when the tooltip event emit, you can get the deteced object from the AIS_Context,

then get the data you want to show in the QToolTip from the AIS_Shape by its method: GetOwner();

Regards,

Shing Liu

prasad R's picture

Hi,

I was unable to set the data to AIS shape as per the first step you have suggested i.e, using SetOwner(), which is expecting a Standard Transient object.

Please elaborate the steps if I am missing out something.

prasad R's picture

Hi,

here is my code of a small box,

TopoDS_Shape aBox = BRepPrimAPI_MakeBox(30.0, 40.0, 50.0).Shape();
    Handle_AIS_Shape aAisBox = new AIS_Shape(aBox);

    aAisBox->SetColor(Quantity_NOC_AZURE);

    myContext->Display(aAisBox);

I am trying to get a tooltip when ever i mouse over on this box.

I was trying to detect the box as you have suggested but failed to get it. Can u just let me know the steps exactly ( I am a complete novice to opencascade ).

Thank you.

regards,

Prasad

prasad R's picture

Hi,

I am trying the suggested solution, but failing to set the data using setOwner.

If any body successfully did it, please share us your solution.

Thank you.

regards,

Prasad