QThread question

  • I'm currently writing an app that uses an instance of QThread to query a db while allowing a dialog on the GUI to display an activity image. However, the problem is that a QVariantList that is accessed and populated by the thread becomes unavailable to the GUI (written in QML btw) after the thread has finished executing. How do I ensure that the QVariantList is still accessible after the thread has finished executing?



  • What do you mean with that? It's a value class. Just don't destroy it but keep it somewhere.

  • If the QVariantList is a member of the thread class, it's clear why tit is away when the thread object is destroyed.
    Make the list a membre of the ui or create it in the thread object and send it via signal/slot or whatever. Don't access the same data object from different threads without synchronising it (which will be difficult in qml!).

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.