i am writing a program with Qt.I have class derived from QWidget.in it's constructor i want to use Linux Socket connect method .and also want to use Qt connect Signal & Slot method . how can i do this .because when i use Socket connect method compiler think i'm using Signal_Slot connect method and give compile error that argument doesn't match and ....
Thanks for any info you may be able to provide.
this is my code:
Login_Page::Login_Page(QWidget *parent) :
QWidget(parent),
ui(new Ui::Login_Page){
ui->setupUi(this);
ui->error_lablel->hide();
//try connect to server
...
if(connect(client_fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))){
ui->login_button->setDisabled(true);
ui->error_lablel->setText("cannot connect to server");
ui->error_lablel->show();
while(true){
if(!(connect(client_fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))))
break;
}
ui->login_button->setDisabled(false);
ui->error_lablel->hide();
}
connect(ui->login_button,SIGNAL(clicked()),this,SLOT(login()));
}
Call the connect method of socket with ::
prefix :
...
if(::connect(client_fd, (struct sockaddr *) &serv_addr, sizeof(serv_addr))){
...