• 6903阅读
  • 2回复

QAxWidget是不是只能在GUI线程中使用 [复制链接]

上一主题 下一主题
离线hanaper
 
只看楼主 倒序阅读 楼主  发表于: 2010-12-13
我在一个线程中创建一个 QAxWidget 对象.
结果出现如下错误
ASSERT failure in QWidget: "Widgets must be created in the GUI thread.", file kernel\qwidget.cpp, line 1133
QObject::killTimers: timers cannot be stopped from another thread
查QAxWidget的帮助 This class is not part of the Qt GUI Framework Edition.
那么在新开的线程中能否创建 QAxWidget.
离线dbzhang800

只看该作者 1楼 发表于: 2010-12-13
Manual 中说的清楚:

Although QObject is reentrant, the GUI classes, notably QWidget and all its subclasses, are not reentrant. They can only be used from the main thread.

题外:你贴的这句话与本问题无关。
This class is not part of the Qt GUI Framework Edition.

它告诉你,如果你购买的是商业版的Qt GUI Framework Edition,那么将不包含该类。
离线hanaper
只看该作者 2楼 发表于: 2010-12-13
thank you.
快速回复
限100 字节
 
上一个 下一个