It is not safe to use pixmaps outside the GUI thread in QT Embedded linux

I ran into one problem

"It is unsafe to use pixmaps outside the GUI thread" in QT Embedded linux Msgstr "Unable to set parent, new parent to another thread"

Any help is appreciated.

+2
source share
2 answers

QPixmap is a screen-dependent, designed and optimized to display images on the screen.

It refers to the underlying graphics system. Most graphics systems are not thread safe. So a warning.

Try using QImage.

+4
source

Since the screen is a device, only one stream at a time can access it. Qt has assigned its "GUI thread" to be the only one to do this.

QObjects, such as QWidgets, are associated with the thread that created them to keep track of all this. If the hierarchy of objects is associated with one thread, and you are trying to change the parent to an object in another thread, then the problem arises ... it cannot be resolved, since children may depend on this particular thread for work.

Eg. If the parent of the object is already set, you cannot use moveToThread (object);

0
source

Source: https://habr.com/ru/post/893567/


All Articles