Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Punching a hole in QT5.0



  • I have a QT Application with Video running and QT Graphics is on top of it. I need to punch a hole so that all graphics layer in a rectangle become transparent and Video becomes visible.

    I checked setMask, but with this API, the hole rectangle becomes white. This is the snippet -

    QRegion r1(0, 0, 1280, 800, QRegion::Rectangle);
    QRegion r2(0, 150, 600, 480, QRegion::Rectangle);
    QRegion visibleReg = r1.subtracted (r2);
    setMask(visibleReg);
    Any help would be appreciated. I am using QT5.



  • Set the mask to the Qt Widget which in on top of video


Log in to reply