ShapeButton clickable area to follow the shape


#1

Hi all I'm trying to get a clickable zone of a ShapeButton class to be exactly what the path describes.

For example if I have a round shaped path in the ShapeButton, it should receive clicks if the mouse if above the ellipse, not in the rectangle bounds area (which is always a rectangle I believe?)

Thanks a lot for your help.

Silvere

 

 


#2

If you have access to the Path, perhaps you could use the Path::contains() function to check if a mouse down or mouse over is inside the Path and handle that accordingly. I'm not sure of the specifics for your case, but I'm pretty sure it's possible.


#3

You’d override hitTest and return true or false depending on if the x, y co-ordinate is contained in the Path.

Rail


#4

Ahh really? That's much easier than I thought it would be. :)


#5

Thanks guys I'll try this today!


#6

It works perfectly cheers