Do you mean like this?
syncro.h
#ifndef SYNCRO_H
#define SYNCRO_H
#include <QtCore>
#include "mythread.h"
class Syncro : public QObject
{
Q_OBJECT
public:
Syncro();
void Initialise(MyThread *);
public slots:
void jumpToFrame(int);
};
#endif // SYNCRO_H
Syncro.cpp
.
.
Syncro::Syncro()
{
setParent(QApplication::instance());
}
.
.
The setParent(QApplication::instance()) shows as an error in VS - incomplete
type is not allowed. Don't I have to specify the QApplication instance rather
than the class name?
Cheers...Paul
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Gerald Combs
Sent: 15 December 2015 21:19
To: Developer support list for Wireshark <[email protected]>
Subject: Re: [Wireshark-dev] Slot on main thread not called when signal is
emitted from another thread
On 12/15/15 8:15 AM, Paul Offord wrote:
> When I run the code the extra thread starts OK and it starts to cycle
> around the loop with the 3 second sleep. However, the connected slot
> function Syncro::jumpToFrame(int new_frame) does not get called. If I
> change the connect from QueuedConnection to DirectConnection the slot
> function gets called but, as expected, in the context of my serviceThread.
> I need the slot function to run on the main thread.
>
> I guess it is because my jumpToFrame slot function is not on the main
> thread event loop, but I don’t understand how to get it on the loop.
Can you try adding a constructor to Syncro, and add either
moveToThread(QApplication::instance()->thread());
or
setParent(QApplication::instance());
to it? I'm not sure if QObjects have a valid thread affinity by default.
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <[email protected]>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:[email protected]?subject=unsubscribe
______________________________________________________________________
This message contains confidential information and is intended only for the
individual named. If you are not the named addressee you should not
disseminate, distribute or copy this e-mail. Please notify the sender
immediately by e-mail if you have received this e-mail by mistake and delete
this e-mail from your system.
Any views or opinions expressed are solely those of the author and do not
necessarily represent those of Advance Seven Ltd. E-mail transmission cannot be
guaranteed to be secure or error-free as information could be intercepted,
corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or omissions in the
contents of this message, which arise as a result of e-mail transmission.
Advance Seven Ltd. Registered in England & Wales numbered 2373877 at Endeavour
House, Coopers End Lane, Stansted, Essex CM24 1SJ
______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
___________________________________________________________________________
Sent via: Wireshark-dev mailing list <[email protected]>
Archives: https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
mailto:[email protected]?subject=unsubscribe