views:

129

answers:

2
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.

+1  A: 

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.

chalup
+1  A: 

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.

Caleb Huitt - cjhuitt