简体   繁体   English

Qt for wasm:错误:使用未声明的标识符'QThreadPool'

[英]Qt for wasm: error: use of undeclared identifier 'QThreadPool'

I'm trying to build my desktop Qt application for Web Assembly and I encountered the problem with threads. 我正在尝试为Web Assembly构建桌面Qt应用程序,但是遇到了线程问题。

When I use QThreadPool I get "use of undeclared identifier 'QThreadPool'" error message. 当我使用QThreadPool “使用未声明的标识符'QThreadPool'”错误消息。 When I use QThread there are no error messages but the thread doesn't start when start() is called. 当我使用QThread ,没有错误消息,但是调用start()时线程没有启动。

How can I compile Qt application with threads for Web Assembly? 如何使用Web汇编线程编译Qt应用程序?

I'm not sure how exactly you're compiling this right now, but maybe it would be good to update your answer to show exactly what version your QT is and your compilation setup. 我不确定您现在的编译方式如何,但是更新您的答案以准确显示您的QT版本和编译设置可能会很好。

To me it seems that many features of QT aren't supported yet on WASM and this is expected! 在我看来,WASM尚不支持QT的许多功能,这是可以预期的! It looks like they are still porting most of the functionality to the Web and it could take some time. 看起来他们仍在将大多数功能移植到Web上,这可能需要一些时间。

If you check the QTBUG-64700 you will see that the threading support is not yet available for WASM (see the pthread issue QTBUG-64625 ). 如果检查QTBUG-64700 ,将看到WASM尚不支持线程支持(请参阅pthread问题QTBUG-64625 )。 The current WebAssembly design plan suggests that this will be a couple of months before Pthread like threads are implemented. 当前的WebAssembly设计计划表明,这将在实现类似Pthread的线程之前几个月。

For more info on the status of QT for WASM I'd check out their blog post where it also states the currently unsuported features, and shows some examples of currently working ones. 有关WASM的QT状态的更多信息,请查看他们的博客文章 ,其中还声明了当前未支持的功能,并显示了一些当前可用功能的示例。 Or see below for a quick summary of the current main issues. 或参见以下内容,以获取当前主要问题的快速摘要。

Things that don't work QTBUG-63917 (as of 2018/05/22) 无效的东西QTBUG-63917 (截至2018/05/22)

Multithreading QTBUG-64700 多线程QTBUG-64700

  • there is a stub QThread 有一个存根QThread
  • disabled in the browsers due to the Spectre vulnerability 由于Spectre漏洞而在浏览器中被禁用

Most QNetwork QTBUG-63920 多数QNetwork QTBUG-63920

  • no DNS lookups due to javascript sandbox 由于javascript沙箱,没有DNS查找
  • simple QNAM requests should work. 简单的QNAM请求应该有效。

Local Filesystem access QTBUG-67834 本地文件系统访问QTBUG-67834

persistent QSettings, it syncs the config rather slow and asynchronously QTBUG-63923 持久的QSettings,它会相当慢地同步配置并异步QTBUG-63923

QOpenGLWIdget QTBUG-66944 QOpenGL小工具QTBUG-66944

Opengl only works fullscreen QTBUG-67717 OpenGL仅适用于全屏QTBUG-67717

some shaders QTBUG-67338 一些着色器QTBUG-67338

  • QResource fails to find shaders built-in to Qt QResource无法找到Qt内置的着色器

The exec loop does not function like other platforms QTBUG-64020 exec循环的功能与其他平台不同QTBUG-64020

  • exec() event loop will not return where you expect it to exec()事件循环不会返回到您期望的位置
  • Returning values from modal dialogs are known not to work but can be worked around by using non-modal signals and show(). 从模态对话框返回值是行不通的,但是可以通过使用非模态信号和show()来解决。 Although modal dialogs/windows will still open. 尽管模式对话框/窗口仍将打开。

toUpperCase QTBUG-66621 至大写QTBUG-66621

QClipboard QTBUG-64638 QClipboard QTBUG-64638


I'm sure there will be more updates and improvements soon, but it looks like you will have to wait! 我相信很快就会有更多更新和改进,但是看来您将不得不等待!

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

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