Results 1 to 6 of 6

Thread: Help with VoidRealms "Threading done correctly"

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,371
    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: Help with VoidRealms "Threading done correctly"

    You cannot access the user interface from a worker thread.
    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.


  2. #2
    Join Date
    Sep 2013
    Posts
    32
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Help with VoidRealms "Threading done correctly"

    Right, I remember that; Give me a half an hour, and I'll try to restructure the application above that the main is setup to receive a signal from the worker.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,371
    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: Help with VoidRealms "Threading done correctly"

    Just remember that using threads "just because you can" is usually a bad idea. Think if you really benefit from having threads in your program in any way.
    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.


  4. #4
    Join Date
    Sep 2013
    Posts
    32
    Thanks
    9
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Help with VoidRealms "Threading done correctly"

    I believe I figured out what I needed to do.

    I made a new class, and just added a parameter to my connections which takes the ui object created in main.cpp

    Without going too much into it, here is a snippet from my worker class source
    Qt Code:
    1. void example::THREAD_example(QThread &cThread, MainWindow &w)
    2. {
    3. connect(&cThread,SIGNAL(started()),&w,SLOT(METHOD_example()));
    4. }
    To copy to clipboard, switch view to plain text mode 

    METHOD_example() is a public slot in the main thread, which takes signals from my worker class, blah blah blah

    anyways, thanks :P

  5. #5
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Help with VoidRealms "Threading done correctly"

    Your original code was almost correct. You can make it work properly by just removing this line
    Qt Code:
    1. cObject.moveToThread(&cThread);
    To copy to clipboard, switch view to plain text mode 

    But since the thread is not doing anything it is not very useful

    Cheers,
    _

Similar Threads

  1. Replies: 1
    Last Post: 3rd December 2013, 02:19
  2. Replies: 1
    Last Post: 7th April 2010, 21:46
  3. Replies: 3
    Last Post: 15th February 2010, 17:27
  4. Replies: 0
    Last Post: 15th November 2009, 09:40
  5. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05

Tags for this Thread

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.