Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
930 views
in Technique[技术] by (71.8m points)

qt - Play a video with custom overlay graphics

I want to play a video (with sound) in a simple GUI with "play" and "stop" buttons etc. There are classes and widgets in Qt's Phonon module for doing that, and several examples. OK, so that seems to be simple.

But now I need to draw some custom graphics (that depend on the current time in the video) on top of the streamed video image. I have not found anything about this in the Qt documentation. What's the canonical way of doing this? Do I just create a custom VideoWidget widget and override its paintEvent? In another question here, some guy seemed to have trouble with this.

Any pointers would be appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Use QGraphicsView and QGraphicsWidgets. You can put your Phonon::VideoWidget inside a QGraphicsProxyWidget and it becomes usable as a QGraphicsWidget.

For custom overlays, inherit QGraphicsWidget and override the paint function to draw your custom widgets. You can add them to your scene and they will appear on top of your video widget.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...