foxyproxy
17th March 2008, 19:03
Hello, this is my frist post and I need your help :)
Im doing a gui by using third-party library but I have a problem. I will do an example to be clear:
#include <iostream>
#include ...
Test::Test()
{
cout << "Constructor called" << endl;
}
Test::method()
{
lib->doSomething();
data = lib->getData();
... // use data returned from the method and update gui
}
The problem is the method doSomething() doesn't return immedialty wot I want but it takes few secs. So when it calls getData(), data variable doesn't contain the right thing.
I think I should implement something like qmutex or qwaitcondition to wait doSomething() method finish. Can someone explain me how to do that, please? And how does it work?
Thank you very much ;)
Im doing a gui by using third-party library but I have a problem. I will do an example to be clear:
#include <iostream>
#include ...
Test::Test()
{
cout << "Constructor called" << endl;
}
Test::method()
{
lib->doSomething();
data = lib->getData();
... // use data returned from the method and update gui
}
The problem is the method doSomething() doesn't return immedialty wot I want but it takes few secs. So when it calls getData(), data variable doesn't contain the right thing.
I think I should implement something like qmutex or qwaitcondition to wait doSomething() method finish. Can someone explain me how to do that, please? And how does it work?
Thank you very much ;)