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..
#include <QtGui/QApplication>
#include <QLabel>
#include <QPushButton>
int main(int argc, char *argv[])
{
QLabel *label
= new QLabel("<h2><i>Hello</i> ""<font color=red>Qt!</font></h2>",button,Qt
::Window);
QObject::connect(button,
SIGNAL(clicked
()),
&a, SLOT(quit()));
label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter);
label->setWindowTitle("HelloWorld Test Program");
label->show();
return a.exec();
}
#include <QtGui/QApplication>
#include <QLabel>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPushButton *button = new QPushButton(NULL);
QLabel *label = new QLabel("<h2><i>Hello</i> ""<font color=red>Qt!</font></h2>",button,Qt::Window);
QObject::connect(button, SIGNAL(clicked()),
&a, SLOT(quit()));
label->setAlignment(Qt::AlignCenter|Qt::AlignVCenter);
label->setWindowTitle("HelloWorld Test Program");
label->show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks