vlc-qt/examples

"QWidget: Must construct a QApplication before a QWidget" when using VlcWidgetVideo class

Opened this issue · 0 comments

So I did it in 2 ways, one is to promote a QWidget to the VlcWidgetVideo with path VLCQtWidgets/WidgetVideo.h (I have already included the path in .pro). The other way is I initialize it dynamically in code

m_video = new VlcWidgetVideo(this);
ui->verticalLayout->addWidget(m_video);

Both gives me the same error when I launch the program,
QWidget: Must construct a QApplication before a QWidget
How do I solve this problem? I tried insert breakpoint in main.cpp and when m_video is constructed, QApplication is definitely constructed before m_video

Another thing to note is when I create VlcInstance, it gives me this warning:
QObject: Cannot create children for a parent that is in a different thread. (Parent is MainWindow(0x73fe00), parent's thread is QThread(0x1e41c7b8), current thread is QThread(0x1fbd3b08)
Is it because VLC-Qt is running on a different thread and that thread doesn't have QApplication?

I can also confirm I got the exact same error when I try the example SimplePlayer project