当前位置:网站首页>Qt线程与界面
Qt线程与界面
2022-06-10 23:33:00 【雨田嘟嘟】
看了个开源库Stacer,里面使用到了QConcrrent,这个使用很方便,这里简单记录一下总结下Qt的线程创建方法。
Qt线程创建方法
- QThread继承
- QObject moveToThread
- QConcurrent::run
Qt中提到线程那么不得不说一下线程和界面组件的关系。
线程与界面组件
- 在QT中,所有界面组件相关的操作都必须在主线程中(也就是GUI thread),在Qt程序线程中不能直接创建QWidget之类的界面组件,也不能直接操作界面组件.
QThread线程如何操作界面组件
方法1
绑定线程对象的信号和UI对象的槽,线程中发送emit信号。
方法2
继承QEvent类,使用QApplication::postEvent()实现向界面发送事件
方法3
直接使用Invokes()函数来调用界面组件对象的信号槽 ,(可用来调用UI对象的私有信号或槽):
边栏推荐
- 圖的最短路徑問題 詳細分解版
- Network Engineer required course firewall security zone and basic operation of security policy
- Automated test series
- Multipass中文文档-概览
- Pirate OJ 148 String inversion
- Deploy netron services through kubernetes and specify model files at startup
- 【无标题】
- Excel cell
- AQS explanation of concurrent programming
- [no title] 4555
猜你喜欢

The JVM determines whether an object can be recycled
![[no title] 66666](/img/6c/df2ebb3e39d1e47b8dd74cfdddbb06.gif)
[no title] 66666

unity 网格面片生成抛物线,折线

跳转页面后回不去默认页面

海贼oj#148.字符串反转

With a market value of 21.5 billion yuan, will the post-80s generation in Sichuan make TV history?
![[database] MySQL index interview questions](/img/ff/8713465293f728f57840237242e227.png)
[database] MySQL index interview questions

Unable to return to the default page after page Jump

452. detonate the balloon with the minimum number of arrows

Wechat applet to realize OCR scanning recognition
随机推荐
Review of software architecture in Harbin Institute of technology -- LSP principle, covariance and inversion
Wechat applet to realize OCR scanning recognition
ts+fetch实现选择文件上传
On the quality assurance system of youzan search V2021
【无标题】
动态规划经典题目三角形最短路径
Detailed decomposition of the shortest path problem in Figure
Objects as points personal summary
Ts+fetch to upload selected files
A simple understanding of B tree
Yii2 ActiveRecord 使用表关联出现的 id 自动去重问题
Multipass Chinese document - instructions for use (contents page)
Décomposition détaillée du problème de chemin le plus court du graphique
Dynamic programming classical topic triangle shortest path
Pirate OJ 148 String inversion
With a market value of 21.5 billion yuan, will the post-80s generation in Sichuan make TV history?
Word删除页眉横线的方法
Block queue - delayedworkqueue Source Analysis
Pirate OJ 448 luck draw
Pirate OJ 146 character string