Listing 4: Button code

01:  HelloWorld::HelloWorld(QWidget *parent, const char *name) : QWidget(parent, name)
02:  {
03:      myCount = 0;
04:      countButton = new QPushButton("Count Button", this);
05:      countButton->setGeometry(100,100,100,40);
06:      countButton->show();
07:
08:      countLabel = new QLabel(QString::number(myCount),this,"countlabel");
09:      countLabel->setGeometry(100,150,200,40);
10:      countLabel->show();
11:  
12:      resetButton = new QPushButton("Reset Button", this);
13:      resetButton->setGeometry(100,200,100,40);
14:      resetButton->show();
15:
16:      connect(countButton, SIGNAL(clicked()), this, SLOT(intCount()));
17:      connect(this, SIGNAL(maxCountReached()), this, SLOT(disableCountButton()));
18:      connect(resetButton, SIGNAL(clicked()), this, SLOT(resetCount()));
19:    }
— End of Listing —