
Originally Posted by
prathibha83
Hi,
I am developing a small application to illustrate signals and slots.
the application has one button and label.
If I click on button It should change the label's text.
And my application is......
quitApp::quitApp(QWidget *parent)
: QWidget(parent)
{
//ui.setupUi(this);
QPushButton *click = new QPushButton("click me", this);
click->setGeometry(50, 40, 75, 30);
label=new QLabel("one",this);
connect(click, SIGNAL(clicked()), label, SLOT(changeText()));
QVBoxLayout* layout = new QVBoxLayout(this);
layout->addWidget(click);
layout->addWidget(label);
}
void quitApp::changeText()
{
label->setText("two");
}
Thanks,
Prathibha.