简体   繁体   中英

Change GUI after child thread is finished - QT

I have a question about QT thread. In my application GUI I want to add image to window, and after some time (when child thread will finish his work and will be closed) I want to remove this image. How in this situation inform main thread that child thread finished his works? I red some QT documentation, but didn't help: http://qt-project.org/doc/qt-4.8/thread-basics.html If it is needed, I will add some code. Thanks in advance for your help.

You need to connect signal finished() of QThread to slot, which will remove your image.

Little example:

QObject::connect(your_thread, SIGNAL(finished()), your_class, SLOT(your_slot()));

class YourClass
{
/* ... */

public slots:
    void your_slot() { /* remove image */ }

/* ... */
};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM