[Qt-interest] post Event from external phidgets function
S. Aguinaga
sa_jr at yahoo.com
Tue Feb 23 00:49:23 CET 2010
Hello fellows,
Is it possible to post an Event from a canned Phidgets function, so that it will be processed by my Event Handler in my Qt class? I want to change the QLabel listed below when the Phidget button is pressed, but right now I'm getting errors because of threading.
Phidget function inside the same cpp file as my class definition:
int InputChangeHandler(CPhidgetEncoderHandle ENC, void *usrptr, int Index, int State)
{
printf("Input #%i - State: %i \n", Index, State);
// initiate an Event here using QCoreApplication::postEvent( .... )
// that can be processed as a keypress event (
return State;
}
The above function is in my file where the class is defined:
#include <XXX>
<skip>
MyQtClass::MyQtClass(QWidget *parent)
: QWidget(parent)
{
// CPhidget related object creation (etc)
// QLabel I want to modify when the Phidget (USB button) is pressed
responseTimer = new QLabel(tr("Patient Response"));
... <skip>
}
void MyQtClass::keyPressEvent( QKeyEvent *event)
{
...
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100222/72047d29/attachment.html
More information about the Qt-interest-old
mailing list