简体   繁体   English

Qt信号/插槽和线程

[英]Qt Signals/Slots and Threads

I'm new to GUI programming and multithreading. 我是GUI编程和多线程的新手。 I am in the process of creating a real-time app that receives information from my car and renders it in some meaningful way. 我正在创建一个实时应用程序,该应用程序从我的汽车接收信息并以某种有意义的方式呈现它。 My app is layed out as 3 threads, the GUI (main thread), the rendering thread and the hardware comm thread. 我的应用布局为3个线程,即GUI(主线程),渲染线程和硬件comm线程。 Inbetwen the the render and the hardware threads is a shared ring buffer. 在渲染和硬件线程之间是一个共享的环形缓冲区。 In the render I have created a timer so that it draws the new interface 20 times a second. 在渲染中,我创建了一个计时器,以便它每秒绘制20次新界面。 I would like the thread to notify the main thread that there is a new screen available and I was thinking a signal/slots method would work the best for this. 我希望线程通知主线程有可用的新屏幕,并且我认为信号/插槽方法对此最有效。 This gets down to my question. 这取决于我的问题。 When my render calls a slot, say Screen_Avalable, that is in my main window object in the main thread, does this slot/method get processed in my worker thread or the main thread? 当我的渲染调用主线程中主窗口对象中的插槽(例如Screen_Avalable)时,该插槽/方法是否在我的工作线程或主线程中得到处理?

默认情况下,它将在主线程中进行处理,但请参阅本指南以获取更多信息。

它在主线程上进行处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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