[Solved] QMediaPlaylist not found in qt5 cmake projet
-
Hi,
I'm trying to integrate QtMultimedia to my qt5 projet (structured with cmake 2.8). When i run the build, i get the following error :
@fatal error: QtMultimedia/QMediaPlaylist : No such file or directory@In the CMakeLists.txt i added the following line (but i doesn't solved the problem) :
@SET(QT_USE_QTMULTIMEDIA TRUE)@Here is my code :
@
#include <QtMultimedia/QMediaPlaylist>int main(int argc, char *argv[])
{
QApplication a(argc, argv);QMediaPlaylist * playlist = new QMediaPlaylist; playlist->addMedia(QUrl("/home/user/Video-Sans titre-0.mpeg")); playlist->setCurrentIndex(1); QMediaPlayer * player = new QMediaPlayer; player->setPlaylist(playlist); QVideoWidget * videoWidget = new QVideoWidget; player->setVideoOutput(videoWidget); videoWidget->show(); player->play(); return a.exec();
}
@Thanks.
-
Hi,
I have not used cmake with Qt 5 yet, but following the logic of qmake, don't you have something like QT_USE_QTMULTIMEDIAWIDGETS ?
Hope it helps
-
I didn't have it. But even if i do it the error still remain.
Thanks for your reply.
-
"This":http://www.kdab.com/using-cmake-with-qt-5/ might help you
-
I've already read this link (thanks). I've solved the problem by adding the following lines (into the CMakeLists.txt) :
@
...
FIND_PACKAGE( Qt5Multimedia REQUIRED )
FIND_PACKAGE( Qt5MultimediaWidgets REQUIRED )
...
SET(QT_USE_QTMULTIMEDIA TRUE)
SET(QT_USE_QTMULTIMEDIAWIDGETS TRUE)
...
QT5_USE_MODULES (${EXECUTABLE_NAME} Multimedia MultimediaWidgets)
...
@Thanks.
-
You're welcome !
Now that it's building, please also update the thread title prepending [solved] so other forum users may know a solution has been found :)