ui/views/detailsview/src/glxdetailscustomicon.cpp
changeset 52 a3a4c0de738e
parent 50 a0f57508af73
child 54 0f0f3f26f787
equal deleted inserted replaced
50:a0f57508af73 52:a3a4c0de738e
     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 <glxdetailscustomicon.h>
       
    22 #include <QEvent>
       
    23 
       
    24 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    25 //mousePressEvent
       
    26 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    27 void GlxDetailsCustomIcon::mousePressEvent(QGraphicsSceneMouseEvent *event)
       
    28 {
       
    29     Q_UNUSED(event)
       
    30 }
       
    31 
       
    32 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    33 //clearCurrentModel
       
    34 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    35 void GlxDetailsCustomIcon::mouseReleaseEvent (QGraphicsSceneMouseEvent *event) 
       
    36 {
       
    37   Q_UNUSED(event)  
       
    38   emit updateFavourites();
       
    39 }
       
    40 
       
    41 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    42 //GlxDetailsCustomIcon
       
    43 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    44 GlxDetailsCustomIcon::GlxDetailsCustomIcon(QGraphicsItem *parent) : HbWidget(parent)
       
    45 {
       
    46   mFavIcon = new HbIconItem(this);
       
    47   HbFrameItem* frame = new HbFrameItem(this);
       
    48   frame->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
       
    49   frame->frameDrawer().setFrameGraphicsName("qtg_fr_multimedia_trans");
       
    50   frame->graphicsItem()->setOpacity(0.2); 
       
    51   setBackgroundItem(frame->graphicsItem(),-1);
       
    52   
       
    53 }
       
    54 
       
    55 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    56 //~GlxDetailsCustomIcon
       
    57 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    58 GlxDetailsCustomIcon::~GlxDetailsCustomIcon()
       
    59 {
       
    60   delete mFavIcon;
       
    61   mFavIcon = NULL;
       
    62 }
       
    63 
       
    64 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    65 //setItemGeometry
       
    66 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    67 void GlxDetailsCustomIcon::setItemGeometry(QRect screenRect) 
       
    68 {
       
    69      setGeometry(screenRect);    
       
    70 }
       
    71 
       
    72 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    73 //setItemSize
       
    74 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    75 void GlxDetailsCustomIcon::setItemSize(const QSizeF &size) 
       
    76 {
       
    77      mFavIcon->setSize(size);
       
    78 } 
       
    79 
       
    80 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    81 //setItemPos
       
    82 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    83 void GlxDetailsCustomIcon::setItemPos(const qreal ax,const qreal ay)
       
    84 {
       
    85     //place the FavIcon with respect to the parent i.e HbWidget 
       
    86     mFavIcon->setPos(ax ,ay);    
       
    87 }
       
    88 
       
    89 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    90 //setItemIcon
       
    91 //--------------------------------------------------------------------------------------------------------------------------------------------
       
    92 void GlxDetailsCustomIcon::setItemIcon(const HbIcon &icon)
       
    93 {
       
    94     mFavIcon->setIcon(icon);    
       
    95 }