Results 1 to 2 of 2

Thread: QThread Error

  1. #1
    Join Date
    Jul 2008
    Posts
    139
    Thanks
    9
    Thanked 18 Times in 15 Posts
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default QThread Error

    Hi,
    I am using the static QSound::play in a non-qt thread. I am getting this error .
    08:45:59:855 Debug: QObject: Cannot create children for a parent that is in a different thread.(Parent is QApplication(0xbebf097c), parent's thread is QThread(0x2cb388), current thread is QThread(0x1bad3f0)
    08:45:59:861 Debug: QObject::startTimer: QTimer can only be used with threads started with QThread.
    It is only displayed the first time I play a sound, then never shown again. Everything is working. Should I be concerned about this error? Will it cause a problem?
    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QThread Error

    If you're bothered about it, use QApplication::postEvent() (or sendEvent()) to post an event to the main thread and in the custom event handler play the sound. This way it'll be played in the main thread and the warning should go away.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Compile 4.4.0
    By LordQt in forum Installation and Deployment
    Replies: 18
    Last Post: 29th May 2008, 13:43
  2. QPSQL driver in windows
    By brevleq in forum Installation and Deployment
    Replies: 31
    Last Post: 14th December 2007, 12:57
  3. Error compiling psql plugin
    By vieraci in forum Installation and Deployment
    Replies: 4
    Last Post: 7th October 2007, 02:49
  4. qt 4.2.2 install on aix
    By try to remember in forum Installation and Deployment
    Replies: 2
    Last Post: 28th March 2007, 12:19
  5. Qt-x11-commercial-src-4.2.0-snapshot-20060824 error
    By DevObject in forum Installation and Deployment
    Replies: 4
    Last Post: 24th August 2006, 23:31

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.