If you want to notify the user whether or not sounds can be played then your best bet is QAudioDeviceInfo. You can query for available input or output devices using the static method
QList<QAudioDeviceInfo> QAudioDeviceInfo::availableDevices(QAudio::Mode mode)
For instance you can replace QSound::isAvailable()
by
!QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).isEmpty()
Edit:
QSound
was part of the gui module, but now is part of the multimedia module (which make more sense). You need take a look at the changes in multimedia modules from Qt4 to Qt5 for more info. You may also want to look at QSoundEffect
, which seems to have a richer API