How to achieve the size of video changes as the size of dialog changes?
-
Hi All,
I am a newbie to Qt. Now I have succeeded to play a video on a dialog. However, when I changed the size of dialog, the size of video didn't change. Please refer to the screenshot below.
The following is part of my code.
I used 'resize' to set up the size of video. If I comment the line 26, the dialog cannot show the full video.
So, anyone can help me to solve this problem? Btw, I use Qt5.
Thanks!
-
@EricLiii
I assume when you don't specify any size on theQVideoWidget
it takes up its "natural" size, which is larger than the dialog.You set its initial size. I presume you need to override http://doc.qt.io/qt-5/qdialog.html#resizeEvent and resize the
QVideoWidget
accordingly. You might also be interested in setting theQVideoWidget
'ssetMinimum/MaximumSize()
too. -
Hi,
Why not put your QVideoWidget inside a layout applied to your dialog ? The resizing will be donne automatically.