Is it ok to draw in a QPixmap from a background thread?
-
I am trying to create a QPixmap and draw inside the pixmap . Is it ok to do the same in worker thread . I tried and it seems to work fine . But documentation doesnot recommend to use it in worker thread.
-
I am trying to create a QPixmap and draw inside the pixmap . Is it ok to do the same in worker thread . I tried and it seems to work fine . But documentation doesnot recommend to use it in worker thread.
@Akshaya-Shanker use a QImage instead.
-
@Akshaya-Shanker use a QImage instead.
@ollarch What difference does it make using a QImage instead of QPixmap ? My case is to draw a rect within an image.
-
@ollarch What difference does it make using a QImage instead of QPixmap ? My case is to draw a rect within an image.
@Akshaya-Shanker said in Is it ok to draw in a QPixmap from a background thread?:
What difference does it make using a QImage instead of QPixmap
Why not look by yourself?
https://doc.qt.io/qt-6/qpixmap.html#details
https://doc.qt.io/qt-6/qimage.html#details
--> you want to use a QImage
-
I am trying to create a QPixmap and draw inside the pixmap . Is it ok to do the same in worker thread . I tried and it seems to work fine . But documentation doesnot recommend to use it in worker thread.
@Akshaya-Shanker said in Is it ok to draw in a QPixmap from a background thread?:
I tried and it seems to work fine .
Just because it works fine now on your computer does not mean that it will work fine in the future or on other computers. Please do respect the documentation and save yourself some headaches down the road. I am talking from experience. If the Qt documentation states that you shouldn't do something, you'll get a crash eventually. It's even worse when it is not reproducible and you cannot debug it.