symbianunittestui/qt/dialogmsg.cpp
changeset 2 453d490c84a5
parent 1 753e33780645
child 3 6952856dc269
equal deleted inserted replaced
1:753e33780645 2:453d490c84a5
     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: Dialog class to display some useful message.
       
    15 *
       
    16 */
       
    17 
       
    18 #include <QPushButton>
       
    19 #include <QLabel>
       
    20 #include <QVBoxLayout>
       
    21 #include <QHBoxLayout>
       
    22 #include "dialogmsg.h"
       
    23 
       
    24 DialogMsg::DialogMsg(QWidget* parent): QDialog(parent)
       
    25     {
       
    26     createControls();
       
    27     setLayout();
       
    28     setupEventHandler();
       
    29     }
       
    30 
       
    31 void DialogMsg::createControls()
       
    32     {
       
    33     btnOk = new QPushButton(tr("OK"), this);
       
    34     lableMsg = new QLabel(this);
       
    35     }
       
    36 
       
    37 void DialogMsg::setLayout()
       
    38     {
       
    39     QVBoxLayout* vLayout = new QVBoxLayout(this);
       
    40     vLayout->addWidget(lableMsg);
       
    41     QWidget* wdgt = new QWidget(this);
       
    42     QHBoxLayout* hLayout = new QHBoxLayout(this);
       
    43     hLayout->addWidget(btnOk);
       
    44     wdgt->setLayout(hLayout);
       
    45     vLayout->addWidget(wdgt);
       
    46     }
       
    47 
       
    48 void DialogMsg::setupEventHandler()
       
    49     {
       
    50     connect(btnOk, SIGNAL(clicked()), this, SLOT(close()));
       
    51     }
       
    52 
       
    53 DialogMsg::~DialogMsg()
       
    54     {
       
    55     }
       
    56 
       
    57 void DialogMsg::showMsg(const QString msg)
       
    58     {
       
    59     lableMsg->setText(msg);
       
    60     this->show();
       
    61     int res = this->exec();
       
    62     }