Application Crashes when Text Label widgets are accessed in different threads..why??
Hi
I have MainWindow object instantiated(On Stack) in main.cpp and also 2 threads for 2 cameras(realtime) putting their images on TextLabel widgets(which are in MainWindow).
I access text labels widgets from the threads by passing pointer of MainWindow to those threads(in constructor).
Ex: mw->ui->label_2->setPixMap(...images...);
I have no problem displaying while one thread is active. But when two threads are created , The application crashes.
Hope someone helps.
what is the best GUI architecture for displaying from multiple cameras at a time?
Regards
Re: Application Crashes when Text Label widgets are accessed in different threads..wh
Rule of thumb: don't ever access UI objects from any other thread than the main thread.
There is a QVideoPlayer widget which should be able to display data from a QCamera object.
Cheers,
_
Re: Application Crashes when Text Label widgets are accessed in different threads..wh
Quote:
Originally Posted by
anda_skoa
Rule of thumb: don't ever access UI objects from any other thread than the main thread.
There is a QVideoPlayer widget which should be able to display data from a QCamera object.
Cheers,
_
Hi Anda_skoa
Thanks ....relief came when I knew there is a better way to accessing GUI from other threads.
Then what is the best way to access UI objects from other threads?
It will be very helpful if you guide me towards few resources.
Regards
Re: Application Crashes when Text Label widgets are accessed in different threads..wh
Quote:
Originally Posted by
ganapathi
Thanks ....relief came when I knew there is a better way to accessing GUI from other threads.
There is no such thing, no idea where you got that from.
Quote:
Originally Posted by
ganapathi
Then what is the best way to access UI objects from other threads?
I am repeating myself: the best and only way is to not do it.
Cheers,
_
Re: Application Crashes when Text Label widgets are accessed in different threads..wh
Yaa i found the solution.
implement signals and slots from threads