QPainter logs in stdout

Thomas Lübking thomas.luebking at web.de
Mon Jan 18 22:04:41 GMT 2010


The backtrace hints that paintEvent is called from the eventdispatcher. That's 
probably not it. The painter is simply not opened on the widget (viewport) the 
paintevent was called for (scrollarea) - w/o some special treatment (i don't 
see) that won't work.

Am Monday 18 January 2010 schrieb Ingo Klöcker:
> On Monday 18 January 2010, Thiago Macieira wrote:
> > Em Segunda-feira 18. Janeiro 2010, às 20.50.12, Jaime Torres escreveu:
> > > I have much more info now.
> > >
> > > I've modified Qt4.6.1 (yes, installed in /usr/lib/qt4.5) to include
> > > a kbactrace after every qwarning in QPaint, and here you are why it
> > > happens. But I get lost and can not fix it.
> > >
> > >
> > > QPainter::begin: Widget painting can only begin as a result of a
> > > paintEvent [
> > > 0: /usr/lib/qt4.5/lib/libQtGui.so.4 [0x7fe439a965d8]
> > > 1:
> > > /usr/lib/qt4.5/lib/libQtGui.so.4(_ZN8QPainter5beginEP12QPaintDevice
> > >+0x5ea) [0x7fe439a9ba9a] 2:
> > > /usr/lib/qt4.5/lib/libQtGui.so.4(_ZN8QPainterC1EP12QPaintDevice+0x1
> > >46) [0x7fe439a9c206] 3:
> > > /opt/kde4/lib/libkhtml.so.5(_ZN9KHTMLView10paintEventEP11QPaintEven
> > >t+0x39) [0x7fe429d4fd99] 4:
> > > /opt/kde4/lib/libkhtml.so.5(_ZN9KHTMLView13viewportEventEP6QEvent+0
> > >xfa) [0x7fe429d4841a] 5:
> > > /usr/lib/qt4.5/lib/libQtCore.so.4(_ZN23QCoreApplicationPrivate29sen
> > >dThroug hObjectEventFiltersEP7QObjectP6QEvent+0xc0) [0x7fe43af16900]
> > > 6:
> >
> > Here's the same as a backtrace in gdb. To reproduce:
> >
> > QT_FATAL_WARNINGS=1 konqueror http://qt.nokia.com
> >
> > As you can see from the backtrace, KHTMLView::viewportEvent creates a
> > QPaintEvent and calls paintEvent. That's what causes the issue.
> >
> > However, given the documentation for
> > QAbstractScrollArea::viewportEvent as well as the implementation in
> > Qt, it would seem that paint events are allowed.
> 
> Is this supposed to trigger an immediate repaint? If yes, then IIRC in a
> similar situation (on Windows) we also tried to use paintEvent(). It
> didn't work. After digging into Qt's sources we finally resorted to
> something like
>   QEvent event( QEvent::UpdateRequest );
>   QCoreApplication::postEvent( viewport, &event );
> instead.
> 
> 
> Regards,
> Ingo
> 





More information about the kde-core-devel mailing list