原帖由 GPS 于 12-7-2010 12:13 发表
多谢多谢,再学习去。
之所以问,是因为,我做了一个下载googlemap的程序,开始下载线程后,GUI就不动了,直到下载结束。虽然操作系统会分配时间,但是如果下载线程循环,而且优先级相同的话,是不是还是有影响?
原帖由 GPS 于 12-7-2010 12:40 发表
我再看看哪里出问题了。
刚看了你上面的两个链接,真是切中要害阿,呵呵,一直就在琢磨这个一段时间了。
总结一下理解,看看对不对。
第一篇里,QThread里默认的run()已经启动了消息循环exec(). 当需要新线程时 ...
To set the record straight: I’m not saying sub-classing QThread is wrong. This is also how Java does it (sort of), and many people have been doing this with Qt for a long time.
What I’m saying is “wrong” is subclassing QThread, adding signal and slot code to that subclass, and then calling moveToThread(this); in the constructor of that subclass. This causes people lots of confusion from my experience and observation on the #qt channel and the qt-interest mailing list.
And yes, the current docs are still a bit lacking, something that I am fully aware of (and take responsibility for). I’m planning on sitting down and fleshing them out, showing both ways of using QThread (with and without subclassing).
欢迎光临 FreeOZ论坛 (https://www.freeoz.org/ibbs/) | Powered by Discuz! X3.2 |