Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Qpainter Error
#1
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.
Reply
#2
I suggest you post your code here.
Reply
#3
(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
Reply
#4
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)?
Reply
#5
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.

Attached Files

Thumbnail(s)
   
Reply
#6
I'm pretty sure this is an error in your program. Please provide code.
Reply
#7
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  QPixmap not updating in QGraphicsScene after using QPainter on it Leo_Red 1 1,419 Apr-15-2022, 07:09 PM
Last Post: deanhystad
  [PyQt] QPainter issue showing black screen mart79 0 1,951 May-06-2020, 12:02 PM
Last Post: mart79

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020