QSound error in thread

  • Hello,

    I am trying to play a sound in a non-qt thread:


    I receive this error:
    QObject: Cannot create children for a parent that is in a different thread.

    Any ideas ?



  • Can you create an instance and play that?

    #include <QSound>
    QSound button20Sound(":/button20.wav");

  • Thank you for your answer.
    With your method, the error is not there anymore.

    However, I don't hear the sound. I hear it when I play the file outside the thread (in the main).

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.