Results 1 to 9 of 9

Thread: QMessageBox won't appear.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,321
    Thanks
    316
    Thanked 871 Times in 858 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: QMessageBox won't appear.

    But how can I work with the UI of the mainWindow from the MyClient file ??
    You can't execute GUI code from any thread except the main one. If you need to send information from a worker thread to the main thread, then use signals and slots. If the sender and receiver of a signal / slot connection live in different threads, the sender's signal will automatically be queued to be processed as an event by the receiver's event queue. This is thread safe.

    You can use any parameters in your signal and slot, as long as Qt's metatype system can serialize them into temporary objects while queuing the signal. Most of Qt's built-in data types (like QByteArray or QString) are supported.

    So, if you need to have something in your worker thread cause a change to some GUI feature in the main thread, connect a signal from the worker thread instance to a slot in the main thread, and when the worker thread needs to notify the GUI, send the signal. The slot uses whatever data is transferred to update the GUI.

  2. The following user says thank you to d_stranz for this useful post:

    Vladimir_ (25th September 2014)

Similar Threads

  1. Size of QMessageBox
    By elizabeth.h1 in forum Qt Programming
    Replies: 3
    Last Post: 28th September 2009, 16:00
  2. QMessageBox
    By sonuani in forum Qt Programming
    Replies: 13
    Last Post: 2nd September 2009, 17:56
  3. QMessageBox
    By sonuani in forum Qt Programming
    Replies: 1
    Last Post: 31st March 2008, 08:27
  4. Re: Help on QMessageBox
    By arunvv in forum Newbie
    Replies: 2
    Last Post: 25th March 2008, 23:45
  5. how to use tr() for QMessageBox?
    By gfunk in forum Qt Programming
    Replies: 4
    Last Post: 17th November 2007, 11:30

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.