Q:

How do i add media files to QMediaPlaylist?

I'm a beginner for Qt and C++ and  making a sample media player. I just want create a playlist with using QMediaplaylist class. 
I just want when i click a icon then it's pop up a window that i can select multiple video files and append those file with QMediaplaylist. 
I have done the multiple selection part. but i could not realize how to appends those file with QMediaPlaylist.
playlist = new QMediaPlaylist(player);
QStringList filenames = QFileDialog::getOpenFileNames(this,"Open a File","","Video File(*.*)");
playlist->addMedia(filenames); //error has occurred in this line 
player->setPlaylist(playlist);
on_actionPlay_triggered();

Semantic Issue
  error:no matching member function for call to 'addMedia"
  qmediaplaylist.h:90:10:note:candidate function not viable:no known 
  conversion from 'QStringList' to const QMediaContent' for 1st argument 

  qmediaplaylist.h:91:10:note:candidate function not viable:no known 
  conversion from 'QStringList' to 'const QList<QMediaContent>'for 1st 
  argument 

A:

You have to convert each path in QMediaContent using QUrl::fromLocalFile():
playlist = new QMediaPlaylist(player);
QStringList filenames = QFileDialog::getOpenFileNames(this, "Open a File","","Video File(*.*)");
for(const QString & filename: filenames){
    playlist->addMedia(QMediaContent(QUrl::fromLocalFile(filename)));
}
player->setPlaylist(playlist);

