qt thread with movetothread
来源:互联网 发布:郴州金科软件 编辑:程序博客网 时间:2024/06/06 18:07
The canonical Qt way would look like this:
QThread *thread = new QThread( ); Task *task = new Task(); task->moveToThread(thread); connect( thread, SIGNAL(started()), task, SLOT(doWork()) ); connect( task, SIGNAL(workFinished()), thread, SLOT(quit()) ); //automatically delete thread and task object when work is done: connect( thread, SIGNAL(finished()), task, SLOT(deleteLater()) ); connect( thread, SIGNAL(finished()), thread, SLOT(deleteLater()) ); thread->start();
in case you arent familiar with signals/slots, the Task class would look something like this:
class Task : public QObject{Q_OBJECTpublic: Task(); ~Task();public slots: void doWork();signals: void workFinished();};
原帖地址:http://idas643.blog.163.com/blog/static/167104838201331655619221/
- qt thread with movetothread
- Qt moveToThread
- Qt moveToThread
- Qt moveToThread
- QThread with movetothread
- 在Qt使用moveToThread()
- Qt moveToThread使用说明
- Qt 线程 ---movetothread
- Qt 多线程之MoveToThread()
- 【Qt】QThread::moveToThread
- Qt线程之moveToThread
- 理解QT线程中的moveToThread
- qt中movetothread的使用
- QT 线程之 moveToThread()
- 在Qt使用moveToThread() qt的线程
- moveToThread()
- qt,使用moveToThread函数实现多线程
- MovetoThread : Widgets cannot be moved to a new thread
- Linux内核网络协议栈3-创建socket(1)
- vim中文编码
- java动态代理
- ExecutorService的execute和submit方法
- Versions For Mac 出现 SVN Working Copy xxx locked
- qt thread with movetothread
- 腾讯 iweibo Java API 1.2.1 补充头像和个人信息更新功能接口
- HTML+CSS中控制长字符串的自动换行问题
- [设计模式笔记]一. 创建型模式--3.Abstract Factory模式(二)
- 飞秋教程(飞秋应用管理器)
- Java 动态代理 (JDK自带代理)
- codeforces 132C Logo Turtle--- dp dfs
- hadoop 权限控制
- 用JavaScript隐藏控件的方法