QMediaPlayer setVideoOutput locks up user interface
-
I took the mdi example from qt examples as a starting point. I created my own mdi child window called "VideoMdiChild".
VideoMdiChild *MainWindow::createMdiChild() { VideoMdiChild *child = new VideoMdiChild; mdiArea->addSubWindow(child); return child; }
This video mdi child uses a form that contains a video widget. The video widget contains a QMediaPlayer. When I open the video mdi child it locks up the entire user interface until I resize the window. Once resized, the menu becomes usable again. The toolbar is also unresponsive until I tear it off and place it somewhere else.
If I remove the line "_mediaPlayer->setVideoOutput(videoWidget);" from the following code, then things work properly. Of course this means that the video is not rendered.
VideoWidget::VideoWidget(QWidget *parent) : QWidget(parent) { _mediaPlayer = new QMediaPlayer( this , QMediaPlayer::VideoSurface); QVideoWidget *videoWidget = new QVideoWidget; _mediaPlayer->setVideoOutput(videoWidget); QBoxLayout *layout = new QVBoxLayout; layout->addWidget(videoWidget); setLayout(layout); ... }
Am I doing something obviously wrong? I tried 5.11.2, 5.11.1, and 5.9.7. They all exhibit the same behavior.
Qt 5.11.2 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 5.3.1 20160406 (Red Hat 5.3.1-6)) on "xcb"
OS: Ubuntu 18.04.1 LTS [linux version 4.15.0-42-generic]Architecture: x86_64; features: SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX AVX2
-
So it looks like it turned out to be related to display scaling in KDE. If you set the scale to an even number like 2 then there are no problems. I had changed the scaling to 1.7. I have it set to 2 now and the problem appears to be gone.
-
Hi,
Do you have the same behavior if you use your distribution provided Qt ?
-
So it looks like it turned out to be related to display scaling in KDE. If you set the scale to an even number like 2 then there are no problems. I had changed the scaling to 1.7. I have it set to 2 now and the problem appears to be gone.
-
Thanks for sharing your findings !