jamvm1.5+classpath-0.96+qt4.3 QPixmap:在 GUI 线程之外使用像素图是不安全的

发布于 2024-08-29 19:47:02 字数 157 浏览 4 评论 0原文

jamvm -Dawt.toolkit=gnu.java.awt.peer.qt test

QPixmap: It is not safe to use pixmaps outside the GUI thread

我是Qt新手,不知道如何处理。

jamvm -Dawt.toolkit=gnu.java.awt.peer.qt test

QPixmap: It is not safe to use pixmaps outside the GUI thread

I'm new to Qt, I don't know how to deal with it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你的背包 2024-09-05 19:47:02

我对 jamvm 没有任何经验,但这里有 Qt doc 引用可能会有所帮助:

Qt提供了四个类来处理
图像数据:QImage、QPixmap、QBitmap
和Q图片。 QImage 的设计和
针对 I/O 和直接优化
像素访问和操作,同时
QPixmap 的设计和优化是为了
在屏幕上显示图像。

尝试使用 QImage 而不是 QPixmap 并查看是否有相同的警告/错误消息。

I have no experience whatsoever with the jamvm, but here's the Qt doc quote that might be helpful:

Qt provides four classes for handling
image data: QImage, QPixmap, QBitmap
and QPicture. QImage is designed and
optimized for I/O, and for direct
pixel access and manipulation, while
QPixmap is designed and optimized for
showing images on screen.

Try using QImage instead of QPixmap and see if there is the same warning/error message.

满栀 2024-09-05 19:47:02

由于 QPixmap 是一种依赖于设备的表示形式,并且许多显示驱动程序和系统都不是线程安全的,因此 QPixmap 仅限于在主线程或 GUI 线程中使用,这与 QApplication 对象应该在其中实例化的线程相同。可以在此处的文档中查看简短内容,并阅读有关它的更多信息,请参见 此讨论线程

Since QPixmap is a device-dependent representation, and many display drivers and systems aren't thread-safe, QPixmap is restricted to only being used in the main or GUI thread, which is the same thread your QApplication object should be instantiated in. You can see a brief bit in the documentation here, and read more information about it in this discussion thread.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文