[Qt-interest] Accessing GUI elements from a 'C' callback function

Anil H dspinside at gmail.com
Wed Oct 7 10:13:48 CEST 2009


All,

I am using qt 4.5.2 on x86-linux.
I am using qt slider widget as a seek bar in a media player application.
The seek bar(progress of the movie) has to be moved after a callback
is recieved.
But the callback function is a 'C' function and is called from a
thread created internal to  a C library . Hence GUI elements can't be
accessed in this callback function.

I tried out giving static member functions of mainwindow class as a
callback function to C library. Callback handle as pointer to
mainwindow object(this pointer).
But when i try to access GUI elements in the static member function,
it gives out segmentation fault .
Also it is not a GUI thread to update the GUi element.

Is there any alternate solution to this issue of accessing GUI
elements from a 'C' callback function ?. Or how to accesss GUI
elements from a C callback function in a non-gui thread?

Thanks & regards
Anil H



More information about the Qt-interest-old mailing list