#include "MyButton.h"

 MyWidget::MyWidget(QWidget *parent, const char *name)
        : QWidget(parent,name)
 {
   QPushButton *b1 = new QPushButton("This is button 1",this);
   QPushButton *b2 = new QPushButton("This is button 2",this);
   QLineEdit *t = new QLineEdit("This is a LineEdit",this);
   QGridLayout *grid = new QGridLayout( this, 2, 2, 10 );
   grid->addWidget( b1, 0, 0 );
   grid->addWidget( b2, 1, 0 );
   grid->addWidget( t, 1, 1 );
   QObject::connect(b1, SIGNAL(clicked()),this,SLOT(scrivi1()));
   QObject::connect(b2, SIGNAL(clicked()),this,SLOT(scrivi2()));

 }
  void MyWidget::scrivi1(){cout << "Bottone 1 cliccato!" << endl;} 
  void MyWidget::scrivi2(){cout << "Bottone 2 cliccato!" << endl;} 

int main (int argc, char* argv[])
 {
    QApplication a(argc,argv);
    MyWidget w;
    w.setGeometry(100,100,200,100);
    a.setMainWidget(&w);
    w.show();
    return a.exec(); 
 }




