As this is an audio, we don't need a QVideoWidget. So we can do:
_player = new QMediaPlayer(this); QUrl file = QUrl::fromLocalFile(QFileDialog::getOpenFileName(this, tr("Open Music"), "", tr(""))); if (file.url() == "") return ; _player->setMedia(file); _player->setVolume(50); _player->play();
in the .h:
this will open a dialog where you can choose your music and it will play it.