PDA

View Full Version : why teminate only works with quit() and not any other



srikpen
28th January 2007, 06:59
In the below code when the quit() is replaced with a fuction say myquit(), Why doesn't my app/window terminate? It only works where SLOT( quit()) ) why?

thanks.


#include <qapplication.h>
#include <qpushbutton.h>

int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton *button = new QPushButton("Quit", 0);

QObject::connect(button, SIGNAL(clicked()), &app, SLOT(quit()));
app.setMainWidget(button);
button->show();
return app.exec();
}

aamer4yu
28th January 2007, 08:28
bec QApplication doesnt have the method myquit().


QObject::connect(button, SIGNAL(clicked()), &app, SLOT(quit()));
You are connecting clicked() signal of button object with quit() slot / method of app object. app is an object of QApplication class, and u can call only those slots which are present in the class...

srikpen
28th January 2007, 12:37
Thanks I thought it had to be the name of our project/app function. It works great.