如果仅创建标签并将声子小部件设置为父标签,则标签应显示在其上方。
QLabel *label = new QLabel(phononWidget);label->setText("Text over video!");(我意识到这是C ++,并且您正在使用Python进行工作,但是应该类似)
更新:
以上内容不适用于硬件加速的视频播放。可行的替代方法是创建一个图形场景,然后将视频窗口小部件或播放器添加到场景中,并使用a
QGraphicsTextItem作为文本。将视口设置为a
QGLWidget将启用硬件加速:
QGraphicsScene *scene = new QGraphicsScene(this);Phonon::VideoPlayer *v = new Phonon::VideoPlayer();v->load(Phonon::MediaSource("video_file"));QGraphicsProxyWidget *pvideoWidget = scene->addWidget(v);QGraphicsView *view = new QGraphicsView(scene);view->setViewport(new QGLWidget); //Enable hardware acceleration!QGraphicsTextItem *label = new QGraphicsTextItem("Text Over Video!", pvideoWidget);label->moveBy(100, 100);v->play();


