ganeswidgets/src/hgwidgetitem.cpp
changeset 2 49c70dcc3f17
parent 1 e48454f237ca
child 3 c863538fcbb6
equal deleted inserted replaced
1:e48454f237ca 2:49c70dcc3f17
    62     if (!mVisibility)
    62     if (!mVisibility)
    63         mHgImage->setAlpha(0);
    63         mHgImage->setAlpha(0);
    64     
    64     
    65 }
    65 }
    66 
    66 
       
    67 void HgWidgetItem::setPixmap(const QPixmap &pixmap)
       
    68 {
       
    69     if (!mHgImage)
       
    70     {
       
    71         mHgImage = mRenderer->createNativeImage();
       
    72     }
       
    73     
       
    74     mHgImage->setPixmap(pixmap);
       
    75 
       
    76     if (!mVisibility)
       
    77         mHgImage->setAlpha(0);
       
    78     
       
    79 }
       
    80 
       
    81 
    67 void HgWidgetItem::setTitle( QString title )
    82 void HgWidgetItem::setTitle( QString title )
    68 {
    83 {
    69     mTitle = title;
    84     mTitle = title;
    70 }
    85 }
    71 
    86 
   105         if (vis.canConvert<bool>())
   120         if (vis.canConvert<bool>())
   106         {
   121         {
   107             setVisibility(vis.toBool());
   122             setVisibility(vis.toBool());
   108         }
   123         }
   109         
   124         
       
   125                     
   110         // Convert data to correct format if possible.
   126         // Convert data to correct format if possible.
   111         if(image.canConvert<QImage>()){
   127         if (image.type() == QVariant::Pixmap)
       
   128         {
       
   129             setPixmap(image.value<QPixmap>());
       
   130             mValidData = true;            
       
   131         }
       
   132         else if(image.canConvert<QImage>()){
   112             setImage(image.value<QImage>());
   133             setImage(image.value<QImage>());
   113             mValidData = true;
   134             mValidData = true;
   114         }
   135         }
   115         else if(image.canConvert<HbIcon>()){
   136         else if(image.canConvert<HbIcon>()){
   116             // This is heavy operation but we need to support
   137             // This is heavy operation but we need to support