Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. QThread question

QThread question

Scheduled Pinned Locked Moved Mobile and Embedded
3 Posts 3 Posters 2.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    angusrose
    wrote on last edited by
    #1

    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?

    Regards

    Angus

    1 Reply Last reply
    0
    • D Offline
      D Offline
      dangelog
      wrote on last edited by
      #2

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

      Software Engineer
      KDAB (UK) Ltd., a KDAB Group company

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        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!).

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved