ShapeButton clickable area to follow the shape

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.




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.

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


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

Thanks guys I'll try this today!

It works perfectly cheers