[Kde-games-devel] KDE/kdegames/libkdegames

Stefan Majewsky majewsky at gmx.net
Wed Nov 25 22:48:48 CET 2009


SVN commit 1054334 by majewsky:

QGraphicsTextItem::setDefaultTextColor does not check whether the given
color is equal to the color that was previously set, and issues an
update even then. Because we're calling setDefaultTextColor from the
item's paint event, this behavior sometimes results in an infinite loop
paintEvent -> setDefaultTextColor -> update -> paintEvent.

This commit fixes the weird problem that KGamePopupItem::showMessage
destroys (on some systems) all running timers.

CCMAIL: kde-games-devel at kde.org



 M  +7 -1      kgamepopupitem.cpp  


--- trunk/KDE/kdegames/libkdegames/kgamepopupitem.cpp #1054333:1054334
@@ -63,7 +63,13 @@
     // hope that it is ok to call this function here - i.e. I hope it won't be too expensive :)
     // we call it here (and not in setTextColor), because KstatefulBrush
     // absolutely needs QWidget parameter :)
-    setDefaultTextColor(m_brush.brush(widget).color());
+    //NOTE from majewsky: For some weird reason, setDefaultTextColor does on some systems not check
+    //whether the given color is equal to the one already set. Just calling setDefaultTextColor without
+    //this check may result in an infinite loop of paintEvent -> setDefaultTextColor -> update -> paintEvent...
+    const QColor textColor = m_brush.brush(widget).color();
+    if (textColor != defaultTextColor())
+        setDefaultTextColor(textColor);
+    //render contents
     p->save();
     p->setOpacity(m_opacity);
     QGraphicsTextItem::paint(p,option,widget);


More information about the kde-games-devel mailing list