bareil76
20th October 2014, 17:14
Hi All,
I have a problem with the signal/slots for my dll.
Here is my setup:
1) MySystemWrapper.dll is a c wrapper that can be called from python (or other app.. but for now I use python to debug).
The connect() function calls the Qt dll that cannot be called with other apps.
bool connect(){
QAppPriv::pApp = new QCoreApplication(QAppPriv::argc, QAppPriv::argv); //to handle signals and slots
mSystem = new mySystem();
return true;
}
2) In the mySystem.dll the constructor looks like this:
MySystem::MySystem()
{
QThread *thread = new QThread;
//USB HID interface
plugNPlay = new HID_PnP();
plugNPlay->moveToThread(thread);
plugNPlay->start();
////signal slots test
processEventsTmr = new QTimer(this);
processEventsTmr->setInterval(1000); //x ms between each process events
connect(processEventsTmr,SIGNAL(timeout()), this, SLOT(processMyEvents()));
}
The problem I have is that processMyEvents() is never called. So the signal/slot does not work in the MySystem object.
HOWEVER, the signal/slot ARE WORKING in the plugNPlay object.
I think my problem is with the way new QCoreApplication is called but I can figure it out.
I have read this (http://stackoverflow.com/questions/2150488/using-a-qt-based-dll-in-a-non-qt-application) over and over again!
Thanks
I have a problem with the signal/slots for my dll.
Here is my setup:
1) MySystemWrapper.dll is a c wrapper that can be called from python (or other app.. but for now I use python to debug).
The connect() function calls the Qt dll that cannot be called with other apps.
bool connect(){
QAppPriv::pApp = new QCoreApplication(QAppPriv::argc, QAppPriv::argv); //to handle signals and slots
mSystem = new mySystem();
return true;
}
2) In the mySystem.dll the constructor looks like this:
MySystem::MySystem()
{
QThread *thread = new QThread;
//USB HID interface
plugNPlay = new HID_PnP();
plugNPlay->moveToThread(thread);
plugNPlay->start();
////signal slots test
processEventsTmr = new QTimer(this);
processEventsTmr->setInterval(1000); //x ms between each process events
connect(processEventsTmr,SIGNAL(timeout()), this, SLOT(processMyEvents()));
}
The problem I have is that processMyEvents() is never called. So the signal/slot does not work in the MySystem object.
HOWEVER, the signal/slot ARE WORKING in the plugNPlay object.
I think my problem is with the way new QCoreApplication is called but I can figure it out.
I have read this (http://stackoverflow.com/questions/2150488/using-a-qt-based-dll-in-a-non-qt-application) over and over again!
Thanks