Important: Please read the Qt Code of Conduct -

[Solved] QMessageBox stops QSound

  • Hi everybody !

    Qt is new for me and I have to say it...
    It's powerfull! For all my projects, I had to build and learn many libs (ie. pThread for the multi-thread, ncurses for the GUI on terminal [nano like], network...), Qt does it all O_O ...

    This is my first question here, I need help with QSound (on thread).
    The problem is that it works, but when there is a QMessageBox, the sound stops...

    Does anyone have an idea?
    How to put a sound on my app, which doesn't stop on QMessageBox ?

    Thank you all for your help.

  • QSound most likely uses the message loop to send audio samples to a system API for playback. A QMessageBox has it's own message loop that blocks the application loop. Might be the reason for your problem.

    Have you considered using Phonon or QtMultiMedia for audio playback instead of QSound (which is a bit outdated i think)?

  • QMessageBox showing up probably triggers a system sound (through the accessibility integration in QAccessible::updateAccessibility), and that goes through the same channel as the QSound output, and therefore terminates the sound that's playing.

  • Finally I used Phonon...
    But it's a little bit more complicated than QSound ^^

    Anyway, thank you for your help :)

Log in to reply