src/hbcore/image/hbicon.cpp
changeset 30 80e4d18b72f5
parent 23 e6ad4ef83b23
--- a/src/hbcore/image/hbicon.cpp	Fri Sep 17 08:32:10 2010 +0300
+++ b/src/hbcore/image/hbicon.cpp	Mon Oct 04 00:38:12 2010 +0300
@@ -413,9 +413,8 @@
 
 /*! Constructs a new icon with the icon name \a iconName.
 */
-HbIcon::HbIcon(const QString &iconName)
+HbIcon::HbIcon(const QString &iconName) : d( new HbIconPrivate(iconName) )
 {
-    d = new HbIconPrivate(iconName);
 }
 
 /*!
@@ -437,9 +436,8 @@
  * painting performance when compared to a native HbIcon.  Some advanced resource
  * management features are not available for such icons either.
  */
-HbIcon::HbIcon(const QIcon &icon)
+HbIcon::HbIcon(const QIcon &icon) : d( new HbIconPrivate(icon) )
 {
-    d = new HbIconPrivate(icon);
 }
 
 /*!
@@ -672,7 +670,7 @@
             QSizeF pixmapSize = pixmap.size();
 
             // QIcon::pixmap() will not do upscaling.
-            if (pixmapSize.width() < size.width() || pixmapSize.height() < size.height()) {
+            if (!pixmap.isNull() && (pixmapSize.width() < size.width() || pixmapSize.height() < size.height())) {
                 // Native HbIcons are scaled using SmoothTransformation so use the same.
                 pixmap = pixmap.scaled(size.toSize(), aspectRatioMode, Qt::SmoothTransformation);
                 pixmapSize = pixmap.size();
@@ -936,7 +934,7 @@
  * Adds a badge icon to the existing icon. The badge icons
  * are drawn relative to the alignment you specify with the
  * z-order you provide.
- * 
+ *
  * By default the badge icon will use its default size.  If this is
  * not suitable (which is typical in case of vector graphics) then
  * call setSize() explicitly on \a badge before passing it to this