qhbstyle/qhbstyleanimation.cpp
changeset 11 06b8e2af4411
parent 4 90517678cc4f
--- a/qhbstyle/qhbstyleanimation.cpp	Thu May 27 13:42:11 2010 +0300
+++ b/qhbstyle/qhbstyleanimation.cpp	Fri Jun 11 14:26:25 2010 +0300
@@ -36,13 +36,11 @@
 
 QHbStyleAnimation::~QHbStyleAnimation()
 {
-    delete m_animationIcon;
-    delete m_mask;
 }
 
 const QWidget* QHbStyleAnimation::target()const
 {
-    return m_target;
+    return m_target.data();
 }
 
 QPoint QHbStyleAnimation::point()
@@ -69,11 +67,9 @@
         drawer.setFrameType(HbFrameDrawer::ThreePiecesVertical);
     }
     drawer.setFillWholeRect(true);
-    if (m_mask)
-        delete m_mask;
-    m_mask = new QPixmap(m_target->rect().size());
+    m_mask.reset(new QPixmap(m_target->rect().size()));
     m_mask->fill(Qt::transparent);
-    QPainter p(m_mask);
+    QPainter p(m_mask.data());
     drawer.paint(&p, m_target->rect());
     p.end();
 
@@ -92,7 +88,7 @@
     }
 
     if (!iconName.isNull() && !m_target->rect().isEmpty()) {
-        HbIcon* icon = q_check_ptr(new HbIcon(iconName));
+        HbIcon* icon = new HbIcon(iconName);
         if(orientation == Qt::Horizontal)
             icon->setSize(QSize(icon->width(), m_target->rect().height()));
         else
@@ -103,15 +99,12 @@
         const qreal rectHeight = m_target->rect().height();
         const qreal iconHeight = icon->height();
 
-        if (m_animationIcon)
-            delete m_animationIcon;
-
         const int animationWidth = (orientation == Qt::Horizontal) ?  int(rectWidth + iconWidth) : int(rectWidth);
         const int animationHeight = (orientation == Qt::Horizontal) ?  int(rectHeight) : int(rectHeight + iconHeight);
 
-        m_animationIcon = q_check_ptr(new QPixmap(animationWidth, animationHeight));
+        m_animationIcon.reset(new QPixmap(animationWidth, animationHeight));
         m_animationIcon->fill(Qt::transparent);
-        QPainter p(m_animationIcon);
+        QPainter p(m_animationIcon.data());
 
         if (orientation == Qt::Horizontal) {
             if (iconWidth > 0)