title: How to play a sound before splash in QT?
body: <p>I want to play a sound within the splash but with the following code I get the splash to show up and then, only when the splash is gone, the sound to play. Can someone help me out? Thank you very much.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>    QApplication a(argc, argv);
  
      QMediaPlayer * splashSound = new QMediaPlayer;
      splashSound-&gt;setMedia(QUrl("qrc:/sfx/splash_sound.wav"));
      splashSound-&gt;play();
  
      QSplashScreen * mainSplash = new QSplashScreen;
      mainSplash-&gt;setPixmap(QPixmap(":/img/splash.png"));
      mainSplash-&gt;show();
  
      MainWindow w;
  
      QTimer::singleShot(2500, mainSplash, SLOT(close()));
      QThread::msleep(2500);
  
      w.show();
  
      return a.exec();
  </code></pre>