Use child widget as a mask

There is a situation that there is a picture displayed in a window. I want to make a mask which has transparent feature to cover the picture. That is, for example, the mask's background color may be rgba(100,100,100,100). Is it possible to make such mask as the window's child widget? That means the mask and the picture are both the window's children. I don't want the mask is another window to cover the picture window. So that the mask can act same as the main window, ie, moving, resizing, minimizing and so on.