The problem I'm having at the moment is this.
I have a thread running in my application which I want to emit a QT 'signal' when a function in the thread calls a callback function.
I'm running pcap_loop() (from the pcap library) and I've declared the callback function it uses as a static member method of the Qthread it is running in.
This works so far. However I cannot get the callback function to emit the QT signal.
It doesnt seem to see itself as part of the Qthread object, and so when I call the line: "emit Rpacket();"
it errors with: "cannot call member function 'void pcapthread::Rpacket()' without object."
Any help is greatly appreciated :)
my code looks like this.
main.cpp
1 2 3 4 5 6 7 8
int main()
{
//misc code setup application object w
pcapthread sniffeth;
snifeth.start();
return w.exec(); //main event loop
}
pcapthread.h
1 2 3 4 5 6 7 8 9 10 11
class pcapthread : public Thread
{
Q_OBJECT
protected:
void run();
private:
staticvoid got_packet();
signals:
void Rpacket();
}