Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, February 2007
Qt4 warning: QWidget::repaint: Recursive repaint detected


Message 1 in thread

Hi

I am porting a Qt3 application to Qt4 and I keep getting a lot of these 
warnings:

QWidget::repaint: Recursive repaint detected
QPaintEngine::setSystemRect: Should not be changed while engine is active
QPaintEngine::setSystemClip: Should not be changed while engine is active
.
.
.

I use Qt-4.2.2, g++ 4.1.1 20060525 on a fedora core 5 box, and I have 
used qt3to4 on the code.

I tried using Q3Painter instead of QPainter, and when I did so most of 
the warnings disappeared. However, I am still getting a few, does 
anybody know what may be causing them?


-- 
 [ signature omitted ] 

Message 2 in thread

Those warnings occur when QWidget::repaint() is called inside 
QWidget::paintEvent() ...

If your code does it, use QWidget::update() instead.

> Hi
>
> I am porting a Qt3 application to Qt4 and I keep getting a lot of these
> warnings:
>
> QWidget::repaint: Recursive repaint detected
> QPaintEngine::setSystemRect: Should not be changed while engine is active
> QPaintEngine::setSystemClip: Should not be changed while engine is active
> .
> .
> .
>
> I use Qt-4.2.2, g++ 4.1.1 20060525 on a fedora core 5 box, and I have
> used qt3to4 on the code.
>
> I tried using Q3Painter instead of QPainter, and when I did so most of
> the warnings disappeared. However, I am still getting a few, does
> anybody know what may be causing them?



-- 
 [ signature omitted ] 

Attachment: pgp4XCSrGbgHF.pgp
Description: PGP signature


Message 3 in thread

Anderson Medeiros Gomes wrote:
> Those warnings occur when QWidget::repaint() is called inside 
> QWidget::paintEvent() ...
> 
> If your code does it, use QWidget::update() instead.

Hi

Thanks for your advice. I did call QWidget::repaint(), but now I have 
changed it to QWidget::update() as you suggested. Unfortunately I still 
get the warnings described below :(

Is there anything else that could give these warnings? My set up is 
still the same as explained below.


--
 [ signature omitted ] 

Message 4 in thread

Now, I don't know the solution... :(

I looked at QT 4.2.2 source code. Line 706 in 
file /src/gui/painting/qbackingstore.cpp is the only place where the 
message "Recursive repaint detected" appears. It prints that message when it 
detects your QWidget::paintEvent() is called recursively.

Maybe by looking at your paintEvent() function, I can have a idea...

----------------------------------

Another question: within QWidget::paintEvent(), aren't you calling 
QPainter::begin() on the widget twice?

> Anderson Medeiros Gomes wrote:
> > Those warnings occur when QWidget::repaint() is called inside
> > QWidget::paintEvent() ...
> >
> > If your code does it, use QWidget::update() instead.
>
> Hi
>
> Thanks for your advice. I did call QWidget::repaint(), but now I have
> changed it to QWidget::update() as you suggested. Unfortunately I still
> get the warnings described below :(
>
> Is there anything else that could give these warnings? My set up is
> still the same as explained below.
>
>
> --
> Best regards,
> Martin Lilleeng Sætra
>
> >> Hi
> >>
> >> I am porting a Qt3 application to Qt4 and I keep getting a lot of these
> >> warnings:
> >>
> >> QWidget::repaint: Recursive repaint detected
> >> QPaintEngine::setSystemRect: Should not be changed while engine is
> >> active QPaintEngine::setSystemClip: Should not be changed while engine
> >> is active .
> >> .
> >> .
> >>
> >> I use Qt-4.2.2, g++ 4.1.1 20060525 on a fedora core 5 box, and I have
> >> used qt3to4 on the code.
> >>
> >> I tried using Q3Painter instead of QPainter, and when I did so most of
> >> the warnings disappeared. However, I am still getting a few, does
> >> anybody know what may be causing them?
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/



-- 
 [ signature omitted ] 

Message 5 in thread

Anderson Medeiros Gomes wrote:
> Now, I don't know the solution... :(
> 
> I looked at QT 4.2.2 source code. Line 706 in 
> file /src/gui/painting/qbackingstore.cpp is the only place where the 
> message "Recursive repaint detected" appears. It prints that message when it 
> detects your QWidget::paintEvent() is called recursively.
> 
> Maybe by looking at your paintEvent() function, I can have a idea...
> 
> ----------------------------------
> 
> Another question: within QWidget::paintEvent(), aren't you calling 
> QPainter::begin() on the widget twice?
> 
>> Anderson Medeiros Gomes wrote:
>>> Those warnings occur when QWidget::repaint() is called inside
>>> QWidget::paintEvent() ...
>>>
>>> If your code does it, use QWidget::update() instead.
>> Hi
>>
>> Thanks for your advice. I did call QWidget::repaint(), but now I have
>> changed it to QWidget::update() as you suggested. Unfortunately I still
>> get the warnings described below :(

Are you calling QWidget::update() from within your paintEvent() 
function? If so, that is the problem. QWidget::update() sends a paint 
event which, in turn, causes the paintEvent function to be called. If 
you call update() from within paintEvent(), you get recursion.
>>
>> Is there anything else that could give these warnings? My set up is
>> still the same as explained below.
>>
>>
>> --
>> Best regards,
>> Martin Lilleeng Sætra
>>
>>>> Hi
>>>>
>>>> I am porting a Qt3 application to Qt4 and I keep getting a lot of these
>>>> warnings:
>>>>
>>>> QWidget::repaint: Recursive repaint detected
>>>> QPaintEngine::setSystemRect: Should not be changed while engine is
>>>> active QPaintEngine::setSystemClip: Should not be changed while engine
>>>> is active .
>>>> .
>>>> .
>>>>
>>>> I use Qt-4.2.2, g++ 4.1.1 20060525 on a fedora core 5 box, and I have
>>>> used qt3to4 on the code.
>>>>
>>>> I tried using Q3Painter instead of QPainter, and when I did so most of
>>>> the warnings disappeared. However, I am still getting a few, does
>>>> anybody know what may be causing them?
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> "unsubscribe" in the subject or the body. List archive and information:
>> http://lists.trolltech.com/qt-interest/
> 
> 
> 

--
 [ signature omitted ]