phoneuis/bubblemanager2/bubblecore/src/bubbleimagewidget.cpp
changeset 21 92ab7f8d0eab
child 27 2f8f8080a020
equal deleted inserted replaced
4:c84cf270c54f 21:92ab7f8d0eab
       
     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:  Widget to display contact image.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <hblabel.h>
       
    19 #include "bubbleimagewidget.h"
       
    20 
       
    21 BubbleImageWidget::BubbleImageWidget(QGraphicsItem* parent)
       
    22     : HbWidget(parent), mLabel(new HbLabel(this))
       
    23 {
       
    24     mLabel->setAlignment(Qt::AlignCenter);
       
    25     mLabel->setAspectRatioMode(Qt::KeepAspectRatioByExpanding);
       
    26 }
       
    27 
       
    28 BubbleImageWidget::~BubbleImageWidget()
       
    29 {
       
    30 }
       
    31 
       
    32 void BubbleImageWidget::setImage(const QString& name)
       
    33 {
       
    34     if (name != mImageName) {
       
    35         HbIcon icon(name);
       
    36         mLabel->setIcon(icon);
       
    37     }
       
    38 }
       
    39 
       
    40 void BubbleImageWidget::resizeEvent(
       
    41     QGraphicsSceneResizeEvent *event)
       
    42 {
       
    43     Q_UNUSED(event);
       
    44     // set geometry without layout manager, because
       
    45     // image size is not defined in docml
       
    46     mLabel->setGeometry(rect());
       
    47 }