hello everybody,
I have a place in code shown below where slot emits dataAvailable(). After that control will pass to corresponding slot. Do control returns back after execution of that slot.
void MyThread::run()
{
int fd0 = open("/home/prince/mydev01",O_RDWR|O_NONBLOCK);
while( ! _end )
{
read(fd0,&x,sizeof(int));
read(fd0,&y,sizeof(int));
emit dataAvailable();
_semaphore.acquire();
}
close(fd0);
emit stopThreadSignal();
cout<<"\tdataAvailable called";
}
void MyThread::run()
{
int fd0 = open("/home/prince/mydev01",O_RDWR|O_NONBLOCK);
while( ! _end )
{
read(fd0,&x,sizeof(int));
read(fd0,&y,sizeof(int));
emit dataAvailable();
_semaphore.acquire();
}
close(fd0);
emit stopThreadSignal();
cout<<"\tdataAvailable called";
}
To copy to clipboard, switch view to plain text mode
In this case dataAvailable() leads to
void MyDialog::receiveOnRead()
{
sx.setNum(mth.x);
sy.setNum(mth.y);
label
->setText
(sx
+QString(" ") +sy
);
cout<<"From dialog thread"<<mth.x<<" "<<mth.y;
}
void MyDialog::receiveOnRead()
{
QString sx;
sx.setNum(mth.x);
QString sy;
sy.setNum(mth.y);
label->setText(sx+QString(" ") +sy);
cout<<"From dialog thread"<<mth.x<<" "<<mth.y;
}
To copy to clipboard, switch view to plain text mode
It just replaces the lable text.
Well i am sorry i keep asking such related questin again n again but ihave some doubts still prsisting. I have tried with some test pgms which donot make concept clear.
Bookmarks