I am an absolute newbie. I am trying to test a simple application that has a pushbutton with colourful label and when I press that button, the application exits. But, its not working as expected.

I am conceptually wrong somewhere.. Pls help..

Qt Code:
  1. #include <QtGui/QApplication>
  2. #include <QLabel>
  3. #include <QPushButton>
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication a(argc, argv);
  8. QPushButton *button = new QPushButton(NULL);
  9. QLabel *label = new QLabel("<h2><i>Hello</i> ""<font color=red>Qt!</font></h2>",button,Qt::Window);
  10. QObject::connect(button, SIGNAL(clicked()),
  11. &a, SLOT(quit()));
  13. label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter);
  14. label->setWindowTitle("HelloWorld Test Program");
  15. label->show();
  16. return a.exec();
  17. }
To copy to clipboard, switch view to plain text mode