Sorry if my qustion is lame, but i am new in Qt(and ofc my english level too). So, I have a console application in QT, and i use c++. I would like to create a text-based mini game and i need some background music. I used QMediaPlayer QT class for this, and it worked... but i realise i can not loop the music. I found another QT Class for this the QMediaPlaylist. But the loop function did not work (it played just once). I tried it in a maindwindow application and if i used in the mainwindow.cpp it worked fine. And i dont know why, and where is my fault? I tried this way:

main.cpp
Qt Code:
  1. int main(int argc, char *argv[])
  2. {
  3. QCoreApplication a(argc, argv);
  4. Menu();
  5.  
  6. return a.exec();
  7. }
To copy to clipboard, switch view to plain text mode 
menu.cpp
Qt Code:
  1. Menu::Menu(QObject *parent) : QObject(parent)
  2. {
  3. ///...........
  4. this->mp = new MediaPlay();
  5. mp->PlayMusic("backgroundmusic.mp3");
  6. ///...........
  7. }
To copy to clipboard, switch view to plain text mode 
Mediaplay.cpp
Qt Code:
  1. MediaPlay::MediaPlay(QObject *parent) : QObject(parent)
  2. {
  3.  
  4. }
  5.  
  6. void MediaPlay::PlayMusic(QString name)
  7. {
  8. this->playlist = new QMediaPlaylist(this);
  9. this->settings = new QSettings(QDir::currentPath() + "/settings.ini", QSettings::IniFormat);
  10. playlist->addMedia(QUrl::fromLocalFile(".//res//"+name));
  11. playlist->setPlaybackMode(QMediaPlaylist::PlaybackMode::Loop);
  12.  
  13. this->player = new QMediaPlayer(this);
  14. player->setVolume(settings->value("iVolume").toInt());
  15. player->setPlaylist(playlist);
  16. player->play();
  17. }
  18.  
  19. void MediaPlay::SetVolume(int valume)
  20. {
  21. settings->setValue("iVolume",valume);
  22. player->setVolume(valume);
  23. }
To copy to clipboard, switch view to plain text mode 
/////////////////////////
follow-up text: I have an exit function in Menu class. In the exit function i call "qApp->quit();" and then not close the console, it sarts playing the background music in loop... but why?