I have a class like this:
#include <QObject>
namespace taservices
{
class ProcessHandle : public QObject
{
Q_OBJECT
public:
ProcessHandle(const void* const processContextPointer, const QString& process_id = "", QObject *parent = 0);
ProcessHandle();
signals:
void progress(const ProcessHandle* const self, const int value);
private:
static void registerAsMetaType();
}
I have a signal:
void progress(const ProcessHandle* const self, const int value);
I want to connect it through QueuedConnedtion. I keep getting this message:
QObject::connect: Cannot queue arguments of type 'ProcessHandle*const'
(Make sure 'ProcessHandle*const' is registered using qRegisterMetaType().)
I will register my class as follows after the declaration:
Q_DECLARE_METATYPE(taservices::ProcessHandle*);
I also added this static method, which I call from the constructor:
void ProcessHandle::registerAsMetaType()
{
static bool called = false;
if(!called) {
called = true;
qRegisterMetaType<ProcessHandle*>("taservices::ProcessHandle*");
}
}
I also tried registering a pointer const:
qRegisterMetaType<ProcessHandle*const>("taservices::ProcessHandle*const");
This causes the following error:
error C2440: 'return' : cannot convert from 'taservices::ProcessHandle *const *' to 'void *'
So how do I get my class to work with connections in the queue?
source
share