Solved Catch QFrame to QPixmap
-
This post is deleted! -
@mrjj
If render to QPainter then waterfall of messages(null):0 ((null)): QWidget::repaint: Recursive repaint detected
appears in app window and then app fails.
I run this code inside paintEvent() as I said before. Looks like render to QPainter calls paintEvent() - therefore recursion appears. But I need get content of frame inside paintEvent()... I have to think more...
-
@Gourmet
Can you show the whole function ?
Do you ask the QFrame to render() inside its own paintEvent ?? -
@mrjj
No.
Yes. I already said this before. -
@Gourmet
Well you are still not showing full code.
I done this many times and normally have zero issue with it.
(for screen shot features)
So you are clearly doing something odd, wrong or unexpected.
But you only said
"piece of code from paintEvent() of this class"
and show nothing more relevant information. -
Hi,
That's the main problem, you're asking the widget to paint itself when it's already painting itself, hence the error you get.
Do that somewhere else but not in the paintEvent of your QFrame.
-
Ah, i missed the YES mean he called inside QFrame paint. :)
That will lead to recursive behavior.
Thanks @SGaist -
Yes, gotcha... just made QPixmap pm class-wide field and removed pm = grab(QRect(QPoint(0,0),size())); to another method before update() - and all is working. To be on safe side just set pm = pm.scaled(size()); in init. Don't know is it necessary or not.
-
@Gourmet
It will grab it in its exact size.
So should not be needed. -
It's not since in the constructor the size of the widget is still unknown.
-
@SGaist
Not in constructor - Instead of this my widget has another init function called by plugin loader.