homescreenapp/examples/helloworldwidgetplugin/src/helloworldwidget.cpp
changeset 62 341166945d65
parent 46 23b5d6a29cce
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
    30 */
    30 */
    31 
    31 
    32 /*!
    32 /*!
    33     Constructs a widget which is a child of \a parent, with widget flags set to \a flags.
    33     Constructs a widget which is a child of \a parent, with widget flags set to \a flags.
    34 */
    34 */
       
    35 // Start of snippet 1
    35 HelloWorldWidget::HelloWorldWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
    36 HelloWorldWidget::HelloWorldWidget(QGraphicsItem* parent, Qt::WindowFlags flags)
    36     : HbWidget(parent, flags)
    37     : HbWidget(parent, flags)
    37 {
    38 {
    38     QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
    39     QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
    39     setLayout(layout);
    40     setLayout(layout);
    40     HbLabel *helloWorld = new HbLabel("Hello World!");
    41     HbLabel *helloWorld = new HbLabel("Hello World!");
    41     helloWorld->setPreferredSize(QSizeF(130.0,20.0));
    42     helloWorld->setPreferredSize(QSizeF(130.0,20.0));
    42     layout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
    43     layout->setContentsMargins(0.0, 0.0, 0.0, 0.0);
    43     layout->addItem(helloWorld);
    44     layout->addItem(helloWorld);
    44 }
    45 }
       
    46 // End of snippet 1
    45 
    47 
    46 /*!
    48 /*!
    47     Destructor
    49     Destructor
    48 */
    50 */
    49 HelloWorldWidget::~HelloWorldWidget()
    51 HelloWorldWidget::~HelloWorldWidget()
    51 }
    53 }
    52 
    54 
    53 /*!
    55 /*!
    54     Called when widget is shown in the home screen
    56     Called when widget is shown in the home screen
    55 */
    57 */
       
    58 // Start of snippet 2
    56 void HelloWorldWidget::onShow()
    59 void HelloWorldWidget::onShow()
    57 {
    60 {
    58 }
    61 }
       
    62 // End of snippet 2
    59 
    63 
    60 /*!
    64 /*!
    61     Called when widget is hidden from the home screen
    65     Called when widget is hidden from the home screen
    62 */
    66 */
       
    67 // Start of snippet 3
    63 void HelloWorldWidget::onHide()
    68 void HelloWorldWidget::onHide()
    64 {
    69 {
    65 }
    70 }
       
    71 // End of snippet 3