diff -r c76ea6caa649 -r b276843a15ba mpx/mpxviewframeworkqt/tsrc/simpleviewpluginsrc/simpleview.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpx/mpxviewframeworkqt/tsrc/simpleviewpluginsrc/simpleview.cpp Tue Sep 21 11:25:55 2010 -0500 @@ -0,0 +1,72 @@ +/* +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* +*/ + +#include "simpleview.h" + +#include +#include +#include +#include +#include + +#include +#include +#include + +SimpleView::SimpleView(const QString &name) +: +HbView() + { + setObjectName(name); + setTitle(name); + mapper = new QSignalMapper(this); + mapper->setParent(this); + + setTitle(title()); + QSizePolicy policy(QSizePolicy::Fixed, QSizePolicy::Fixed); + + QGraphicsGridLayout *layout = new QGraphicsGridLayout(); + + label = new HbLabel(); + label->setSizePolicy(policy); + layout->addItem(label, 7, 1, 3, 1); + + connect(mapper, SIGNAL(mapped(int)), this, SLOT(setLabelText(int))); + + bool result = false; + + } + +SimpleView::~SimpleView() + { + } + +bool SimpleView::connectButton(HbPushButton *button, int commandId) + { + bool result = connect(button, SIGNAL(clicked()), mapper, SLOT(map())); + if (result) { + mapper->setMapping(button, commandId); + } + return result; + } + +void SimpleView::setLabelText(int commandId) + { + QString ltext("command id: %1"); + label->setText(ltext.arg(commandId)); + } +