The question is a bit difficult to explain, but I will try.
I have an image of a button:

And I also have some animations of it, such as (gif with a single loop, reload it to view the animation!):

Also, I have some kind of a pattern:

So, now the question: how to make the button react (for example on clicks/hower/etc) only when the mouse is INSIDE the black part of the pattern, and disallow such reactions when the mouse is out of the scope of this pattern? Without modifiyng the graphical files of course. And of course the pattern itself should be invisible.
I want to make that with help of C++ and Qt.
Just please indicate me at least the path, which functions/classes of Qt should I look for! Because now I am completely lost.
One way I can think of doing this, is installing an event filter on the particular button, by calling the
void QObject::installEventFilter ( QObject * filterObj )method of the button. Documentation can be found here.What it boils down to, is creating a QObject specifically for the purpose of filtering mouse events, based on a binary image. All you have to do is override the
bool QObject::eventFilter ( QObject * watched, QEvent * event )method of this new object, and then install that object as the filter for the button. As part of the constructor for this filter class, pass it a reference to the binary image. This binary image reference will sit as a member variable in the filter object, and we can use it to decide which pixels of the button respond to mouse events.In the
eventFiltermethod:x()andy()trueat that point, do one thing, otherwise do something elseThis filter class should be generic enough that you can create multiple instances of it with different binary images for different buttons/widgets.
Hope this helps.