Important: Please read the Qt Code of Conduct -

SetMask() broken on OS X?

  • I am using setMask to create a hole in a widget with the intent being that I'll be able to see and interact with the widget beneath it through the hole. In particular, that all mouse/keyboard events directed at the underlying widget pass through the masked widget appropriately.

    Using Qt 4.8.4 this works fine on Windows and Linux, but on Mac the events are being received by the top widget instead of the one underneath it. I've tried with Qt 5.3 and found it works on all platforms, but I'm not able to jump so far forward any time soon.

    I am doing something like the following to create the mask:

    @QRegion mask = QRegion(QRect(0,0,20000,20000));

    BOOST_FOREACH(QRect rect, maskRects)
    mask = mask.subtracted(rect);


    Does anybody have any ideas why this would be broken on Mac for 4.8.4?

  • Moderators

    Please try out Qt 4.8.6, maybe it has been fixed there. A lot of fixes that make it into Qt 5 are backported to Qt 4.

    Also, you are aware Qt provides foreach macro, so you do not need to use BOOST_FOREACH?

Log in to reply