Python Forum

Full Version: Qpainter Error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Dear all,

I faced a bug that happen sometime in my program.

It is not occur everytime, but show up randomly.

QPainter::begin: Paint device returned engine == 0, type: 3
QPainter::setCompositionMode: Painter not active
QPainter::end: Painter not active, aborted

Is anyone have any idea how to solve?

Thanks.
I suggest you post your code here.
(Jul-02-2020, 11:39 AM)Knight18 Wrote: [ -> ]I suggest you post your code here.

Hi Knight18,

The code is generated from Pyside2 Designer.
It is about 1000 lines
According to the docs QPainter::begin returns True if successful, else False. Reasons for failure are the provided QPaintDevice is 0 (your problem), a provided paint image is null (None), or there is more than one painter.

I am confused about the type. The docs say type 3 is macOS's Quartz2D (CoreGraphics).
What did you use to get the Paint device (engine 0)? I think that is where you should be looking for the problem.

Getting a peek at the code would be interesting. Could you snip the part that is creating/initializing the argument that is passed to QPainter.begin(arg)?
The error as show in figure in attachment.

They are not looking nice, but once I double click on those not complete display box, the value will come out.

Could you snip the part that is creating/initializing the argument that is passed to QPainter.begin(arg)?
I did not see anything related to Qpainter.begin, so I am not sure where to snip my code.

I suspect that, when I insert more Qlineedit boxes, this error will be more often.

Thanks.
I'm pretty sure this is an error in your program. Please provide code.
Dear all,

I suspect there is an error in my code.

I use combobox to have more than one data.
When I switch from first to another, I did not do a proper reset, and cause error.
This is what I suspect so far, I am working on proper reset function and see whether problem solved or not.

Thanks.