正如1楼所说的那样,你可以用一个新的widget作为容器,把你现在显示视频图像的QLabel放在窗体的底层,然后再用一个新的QLabel覆盖在上面,也就是总共有两层窗体,下面那层的QLabel显示视频图像,上面那一层QLabel就显示你要绘制的线条。
ps:要把某个窗体设置到顶层可以使用raise方法,前提条件是这些窗体都具有同一个父窗体。文档描述如下
void QWidget::raise () [slot]
Raises this widget to the top of the parent widget's stack.
After this call the widget will be visually in front of any overlapping sibling widgets.
Note: When using
activateWindow(), you can call this function to ensure that the window is stacked on top.
See also
lower() and
stackUnder().