Magnus Lovdahl
|
Calling an event function in a QT thread from a QNX thread.
|
Magnus Lovdahl
05/23/2012 7:43 AM
post93254
|
Calling an event function in a QT thread from a QNX thread.
Hello,
I have a 'AM335x EVM board' and have downloaded the BSP “Texas Instruments AM335x EVM” project. I use QNX 6.5.0 and
Momentics 4.7.0.
I have an issue that I don’t know how to call event/message functions inside the “QT thread” from a QNX thread in my
QNX application.
In main I create a thread for receiving can messages. When I have received a can message I would like to send an event/
message/signal to my “myqtclass” event function or another function inside the object. I end up in the function
myqtcalss::event but I still execute in the “qnx function thread” not the “QT thread”. Because of this I receive an
error message from QT. I would like to send an event/message/signal so the “QT thread” execute it. Do you have any
suggestion how to do this?
Example code:
*********************
main.c
MyQTClass *myqtcalss;
int main(int argc, char **argv)
{
// Creating QNX can receive function thread
…
QApplication app(argc, argv);
// QT code
…
myqtcalss = new MyQTClass;
…
return app.exec();
}
*********************
myclass.cpp
bool myqtcalss::event(QEvent *event)
{
// Here I would like to end up in the “QT thread”
}
*********************
qnx.c
void QNX_thread_function( void *pvParameters )
{
// Code that executes when a can message is received
QEvent event((QEvent::Type)1001);
QApplication::sendEvent(myqtclass, &event);
}
*********************
|
|
|