Making sure that recursion will not go beyond 20 levels.
svn path=/trunk/KDE/kdelibs/; revision=1070481
This commit is contained in:
parent
8fb2ea1980
commit
8c356fa8c1
@ -20,12 +20,14 @@
|
||||
#include <QImage>
|
||||
#include <QPixmap>
|
||||
#include <QStyleOptionGraphicsItem>
|
||||
static const int RECURSION_MAX = 20;
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
ShadowFake::ShadowFake(QGraphicsItem *parent)
|
||||
: QGraphicsWidget(parent),
|
||||
stack(0),
|
||||
m_target(0)
|
||||
{
|
||||
}
|
||||
@ -46,22 +48,25 @@ void ShadowFake::paintSubChildren(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QGraphicsItem *target)
|
||||
{
|
||||
++stack;
|
||||
QList<QGraphicsItem *> list = target->childItems();
|
||||
QGraphicsItem *tmp;
|
||||
if (list.size() > 0) {
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
tmp = list.value(i);
|
||||
if (tmp->childItems().size() > 0) {
|
||||
if ((tmp->childItems().size() > 0) && (stack < RECURSION_MAX)) {
|
||||
paintSubChildren(painter, option, tmp);
|
||||
} else {
|
||||
tmp->paint(painter, option, 0);
|
||||
}
|
||||
|
||||
tmp->paint(painter, option, 0);
|
||||
}
|
||||
}
|
||||
--stack;
|
||||
}
|
||||
|
||||
void ShadowFake::setTarget(QGraphicsWidget *target)
|
||||
{
|
||||
stack = 0;
|
||||
m_target = target;
|
||||
setParentItem(target);
|
||||
resize(target->size());
|
||||
|
@ -42,6 +42,7 @@ private:
|
||||
void paintSubChildren(QPainter *painter,
|
||||
const QStyleOptionGraphicsItem *option,
|
||||
QGraphicsItem *target);
|
||||
int stack;
|
||||
QPixmap m_photo;
|
||||
QGraphicsWidget *m_target;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user