If you don't want to install NAS and recompile QT with nas support you
can use QProcess and start external app that will play the sound file

Example (QT3.x):


the cration of the process
Qt Code:
  1. QProcess *AlarmProcess;
  2. AlarmProcess = new QProcess (this);
  3. AlarmProcess->setArguments("playwave"); // the player
  4. AlarmProcess->addArgument("alarm.wav"); // the file
To copy to clipboard, switch view to plain text mode 

playing
Qt Code:
  1. AlarmProcess->start();
To copy to clipboard, switch view to plain text mode 

stopping
Qt Code:
  1. AlarmProcess->tryTerminate(); // it actualy waits for the process to finish
  2. // then it terminates
To copy to clipboard, switch view to plain text mode 

you can also use:
Qt Code:
  1. AlarmProcess->Terminate();
To copy to clipboard, switch view to plain text mode 
but it terminates the process immediately, and the memory used might not be cleaned completely.

If you need to play the sound repeatedly you should connect the processExited() signal
Qt Code:
  1. connect( AlarmProcess, SIGNAL(processExited()),
  2. this, SLOT(exitedSlot()) );
To copy to clipboard, switch view to plain text mode 

and to implement the signal hendler
Qt Code:
  1. void FormMain::exitedSlot()
  2. {
  3. if (AlmSound) // flag - should the sound be played again
  4. AlarmProcess->start();
  5. }
To copy to clipboard, switch view to plain text mode 

Cheers, chombium