1 year ago
#372003
Elif Kantar
I would like to write ethernet datas to label
I have a problem.I have an ethernet connection in ethernet class.I have to write data's (coming from ethernet) to ui label.Here is my ethernet class run method.
void ethernetthread::run(){
printf("Connecting to hello world sever");
void *context = zmq_ctx_new();
void *requester=zmq_socket(context ,ZMQ_REQ);
zmq_connect(requester,"tcp://localhost:5555");
int request_nbr;
for(request_nbr=0; request_nbr!=10; request_nbr++){
char buffer[10];
printf("Sending Hello %d\n" ,request_nbr);
zmq_send(requester ,"DERGISOKAK",10,0);
zmq_recv(requester ,buffer,10,0);
zmq_recv(requester,buffer,10,0);
for(int i=0;i<10;i++){
printf("%c :",buffer[i]);
qDebug()<<"buffer["<<i<<"] : "<<buffer[i];
}
printf("Received World %d\n",request_nbr);
}
zmq_close(requester);
zmq_ctx_destroy(context);
}
Here is my MainWindow Class
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new
Ui::MainWindow)
{
timerCounter = new QTimer();
connect(timerCounter,SIGNAL(timeout()),this,SLOT(timer_label_test_slot()));
timerCounter->start(1000);
}
void MainWindow::timer_label_test_slot(){
this->ui->label->setText(QString::number(counter));
counter++;
}
So how can I connect this two classes? How can I show ethernet datas to ui label? Maybe I should make signal slot mechanism between two seperate classes.
c++
qt
signals-slots
0 Answers
Your Answer