ui/detailscustomwidget/detailscustomwidgets/glxdetailsicon.cpp
changeset 55 fb37077c270f
child 62 36d93b4dc635
equal deleted inserted replaced
49:f291796e213d 55:fb37077c270f
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:   ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <hbiconitem.h>
       
    20 #include <hbframeitem.h>
       
    21 #include "glxdetailsicon.h"
       
    22 #include <hbstackedlayout.h>
       
    23 #include <QEvent>
       
    24 
       
    25 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    26 //mousePressEvent
       
    27 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    28 void GlxDetailsIcon::mousePressEvent(QGraphicsSceneMouseEvent *event)
       
    29 {
       
    30     Q_UNUSED(event)
       
    31 }
       
    32 
       
    33 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    34 //clearCurrentModel
       
    35 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    36 void GlxDetailsIcon::mouseReleaseEvent (QGraphicsSceneMouseEvent *event) 
       
    37 {
       
    38   Q_UNUSED(event)  
       
    39   emit updateFavourites();
       
    40 }
       
    41 
       
    42 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    43 //GlxDetailsIcon
       
    44 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    45 GlxDetailsIcon::GlxDetailsIcon(QGraphicsItem *parent) : HbWidget(parent)
       
    46 {
       
    47   mFavIcon = new HbIconItem(this);
       
    48   //add the layout to the icon or else the icon is not showed.
       
    49   HbStackedLayout *stackedLayout = new HbStackedLayout;
       
    50   stackedLayout->addItem( mFavIcon );
       
    51   setLayout( stackedLayout );
       
    52   
       
    53   mFavIcon->setOpacity(0.7);
       
    54   HbFrameItem* frame = new HbFrameItem(this);
       
    55   frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
    56   frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
       
    57   frame->graphicsItem()->setOpacity(0.1); 
       
    58   setBackgroundItem(frame->graphicsItem(),-1);   
       
    59 }
       
    60 
       
    61 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    62 //~GlxDetailsIcon
       
    63 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    64 GlxDetailsIcon::~GlxDetailsIcon()
       
    65 {
       
    66   delete mFavIcon;
       
    67   mFavIcon = NULL;
       
    68 }
       
    69 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    70 //setItemIcon
       
    71 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    72 void GlxDetailsIcon::setItemIcon(const HbIcon &icon)
       
    73 {
       
    74     mFavIcon->setIcon(icon);    
       
    75 }