PDA

View Full Version : Button with signals and slots



probine
4th December 2006, 20:15
I have a class that creates a button. A piece of the code is:
*******************************************
connect(btnCreateAccount, SIGNAL(clicked()), this, SLOT(btnCreateAccount_Clicked()));
}


void LoginUi::btnCreateAccount_Clicked()
{
QUrl url("http://www.google.com");
QDesktopServices::openUrl(url);
}
*******************************************

In this code when the button is pressed the btnCreateAccount_Clicked() function is called. To do this I had to create a new entrance for the function in the "public slots:" field.

I am not inheriting from QPushButton.

Is it possible to overwrite the Clicked() signal for that button, so I don't have to create a new entrance in the "public slots:" ?

wysota
4th December 2006, 23:24
No, you have to declare a slot if you want to use it. Come on, it's not that much work!