ganeswidgets/src/hgwidgetitem.cpp
changeset 20 a60f8b6b1d32
parent 17 a10844a9914d
--- a/ganeswidgets/src/hgwidgetitem.cpp	Fri Sep 17 15:55:58 2010 +0300
+++ b/ganeswidgets/src/hgwidgetitem.cpp	Wed Oct 06 14:53:41 2010 +0300
@@ -28,7 +28,8 @@
 mDescription(""),
 mValidData(false),
 mHgImage(NULL),
-mRenderer(renderer)
+mRenderer(renderer),
+mReflectionEnabled(false)
 {
 }
 
@@ -53,16 +54,7 @@
 
 void HgWidgetItem::setImage(const QImage &image)
 {
-    if (!mHgImage)
-    {
-        mHgImage = mRenderer->createNativeImage();
-    }
-    
-    mHgImage->setImage(image);
-
-    if (!mVisibility)
-        mHgImage->setAlpha(0);
-    
+    setPixmap(QPixmap::fromImage(image));
 }
 
 void HgWidgetItem::setPixmap(const QPixmap &pixmap)
@@ -72,13 +64,22 @@
         mHgImage = mRenderer->createNativeImage();
     }
     
-    mHgImage->setPixmap(pixmap);
-
+    mHgImage->setPixmap(pixmap,mReflectionEnabled);
+        
     if (!mVisibility)
         mHgImage->setAlpha(0);
     
 }
 
+void HgWidgetItem::enableReflection(bool enabled)
+{
+    if (mReflectionEnabled != enabled ) {
+        mReflectionEnabled = enabled;
+        if (mHgImage) {
+            mHgImage->updateMirror(enabled);
+        }
+    }
+}
 
 void HgWidgetItem::setTitle( QString title )
 {
@@ -209,7 +210,7 @@
     mDescription = "";
     mValidData = false;
     if (mHgImage)
-        mHgImage->releaseImage();
+        mHgImage->releaseImages();
 
     delete mHgImage;
     mHgImage = 0;