QThread emits finished() signal but isRunning() returns true and isFinished() returns false

后端 未结 3 644
面向向阳花
面向向阳花 2020-12-05 09:02

Below is the code for my qthread implementation. I am trying to get gps data from satellite. QThread doesn\'t produce the finished() signal even when the programs exits

3条回答
  •  青春惊慌失措
    2020-12-05 09:05

    It's intended behavior that the thread doesn't quit until you manually terminate it. The thread object hosts an event loop, so it doesn't Finish until the event loop quits, as Sebastian explained.

    In short, your signal-slot connections are backwards conceptually - the object should terminate the thread when it is finished doing its thing, not the other way around.

提交回复
热议问题