Better initialisation/destruction.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=849654
This commit is contained in:
Alex Merry 2008-08-19 21:34:23 +00:00
parent df487ae43c
commit 8427acfc83

View File

@ -62,6 +62,9 @@ namespace Plasma
IconPrivate::IconPrivate(Icon *i) IconPrivate::IconPrivate(Icon *i)
: q(i), : q(i),
iconSvg(0), iconSvg(0),
m_fadeIn(false),
m_hoverAnimId(-1),
m_hoverAlpha(20/255),
iconSize(48, 48), iconSize(48, 48),
states(IconPrivate::NoState), states(IconPrivate::NoState),
orientation(Qt::Vertical), orientation(Qt::Vertical),
@ -71,14 +74,11 @@ IconPrivate::IconPrivate(Icon *i)
action(0), action(0),
activeMargins(0) activeMargins(0)
{ {
m_hoverAnimId = -1;
m_hoverAlpha = 20/255;
} }
IconPrivate::~IconPrivate() IconPrivate::~IconPrivate()
{ {
qDeleteAll(cornerActions); qDeleteAll(cornerActions);
delete iconSvg;
} }
void Icon::readColors() void Icon::readColors()
@ -94,6 +94,7 @@ IconAction::IconAction(Icon* icon, QAction *action)
m_hovered(false), m_hovered(false),
m_pressed(false), m_pressed(false),
m_visible(false), m_visible(false),
m_selected(false),
m_animationId(-1) m_animationId(-1)
{ {
} }
@ -494,7 +495,7 @@ void Icon::layoutIcons(const QStyleOptionGraphicsItem *option)
void Icon::setSvg(const QString &svgFilePath, const QString &elementId) void Icon::setSvg(const QString &svgFilePath, const QString &elementId)
{ {
if (!d->iconSvg) { if (!d->iconSvg) {
d->iconSvg = new Plasma::Svg(); d->iconSvg = new Plasma::Svg(this);
} }
d->iconSvg->setImagePath(svgFilePath); d->iconSvg->setImagePath(svgFilePath);