homescreenapp/examples/helloworldwidgetplugin/src/helloworldwidget.cpp
changeset 46 23b5d6a29cce
child 61 2b1b11a301d2
equal deleted inserted replaced
39:4e8ebe173323 46:23b5d6a29cce
       
     1 /*
       
     2 * Copyright (c) 2010 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:  Example of home screen widget
       
    15 *
       
    16 */
       
    17 #include <qtDebug>
       
    18 
       
    19 #include <QGraphicsLinearLayout>
       
    20 #include <HbLabel>
       
    21 #include "helloworldwidget.h"
       
    22 
       
    23 /*!
       
    24     \ingroup group_helloworld_widget
       
    25     \class HelloWorldWidget
       
    26     \brief Example implementation for home screen widget.
       
    27 
       
    28     HelloWorldWidget derived from the HbWidget and implements 
       
    29     needed functions for the home screen widget. 
       
    30 */
       
    31 
       
    32 /*!
       
    33     Constructs a widget which is a child of \a parent, with widget flags set to \a flags.
       
    34 */
       
    35 HelloWorldWidget::HelloWorldWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
       
    36     : HbWidget(parent, flags)
       
    37 {
       
    38     QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
       
    39     setLayout(layout);
       
    40     HbLabel *helloWorld = new HbLabel("Hello World!");
       
    41     helloWorld->setPreferredSize(QSizeF(130.0,20.0));
       
    42     layout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
       
    43     layout->addItem(helloWorld);
       
    44 }
       
    45 
       
    46 /*!
       
    47     Destructor
       
    48 */
       
    49 HelloWorldWidget::~HelloWorldWidget()
       
    50 {
       
    51 }
       
    52 
       
    53 /*!
       
    54     Called when widget is shown in the home screen
       
    55 */
       
    56 void HelloWorldWidget::onShow()
       
    57 {
       
    58 }
       
    59 
       
    60 /*!
       
    61     Called when widget is hidden from the home screen
       
    62 */
       
    63 void HelloWorldWidget::onHide()
       
    64 {
       
    65 }