homescreenapp/examples/helloworldwidgetplugin/src/helloworldwidget.cpp
branchRCL_3
changeset 82 5f0182e07bfb
equal deleted inserted replaced
79:f00a6757af32 82:5f0182e07bfb
       
     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 // Start of snippet 1
       
    36 HelloWorldWidget::HelloWorldWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
       
    37     : HbWidget(parent, flags)
       
    38 {
       
    39     QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
       
    40     setLayout(layout);
       
    41     HbLabel *helloWorld = new HbLabel("Hello World!");
       
    42     helloWorld->setPreferredSize(QSizeF(130.0,20.0));
       
    43     layout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
       
    44     layout->addItem(helloWorld);
       
    45 }
       
    46 // End of snippet 1
       
    47 
       
    48 /*!
       
    49     Destructor
       
    50 */
       
    51 HelloWorldWidget::~HelloWorldWidget()
       
    52 {
       
    53 }
       
    54 
       
    55 /*!
       
    56     Called when widget is shown in the home screen
       
    57 */
       
    58 // Start of snippet 2
       
    59 void HelloWorldWidget::onShow()
       
    60 {
       
    61 }
       
    62 // End of snippet 2
       
    63 
       
    64 /*!
       
    65     Called when widget is hidden from the home screen
       
    66 */
       
    67 // Start of snippet 3
       
    68 void HelloWorldWidget::onHide()
       
    69 {
       
    70 }
       
    71 // End of snippet 3