Results 1 to 16 of 16

Thread: QMessageBox in a second thread?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QMessageBox in a second thread?

    The slot will not return anything. You either need to store the variable elsewhere or you need to send a signal to the thread to indicate the return value. I would use a state machine in the thread and use a signal to indicate the return value (ie, the thread would change to paused state when the notification is raised and resume upon receiving the response from the user).

    You might have guessed that I hate blocking code, so everything runs via events and signals

    I've written a file manager before that goes one step further - if it needs a response from the user (eg. overwrite question), it sends a signal to the main thread to request about that file and processes the other files in the background, returning to the other files if and when a response is received from the main thread about those files.
    Last edited by squidge; 23rd May 2011 at 17:30.

Similar Threads

  1. Replies: 5
    Last Post: 22nd February 2011, 21:21
  2. Replies: 7
    Last Post: 27th January 2011, 08:48
  3. Replies: 9
    Last Post: 28th November 2009, 20:31
  4. Replies: 16
    Last Post: 7th October 2009, 08:17
  5. QThread, QMessageBox, gui thread
    By TheKedge in forum Qt Programming
    Replies: 1
    Last Post: 25th October 2006, 12:23

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.