RichardNixon
6th August 2008, 08:02
Hi,
Is it possible to use Q_ARG with reference types? For example:
void foo(QIODevice& obj)
{
QMetaObject::invokeMethod(this, "fooImpl", Q_ARG(QIODevice&, obj));
}
This code does not compile because the template type for QArgument is inferred to be QIODevice&, and the QArgument constructor wants a pointer to this type (something like QIODevice&*). Is there a way around this other than simply not using reference types?
Is it possible to use Q_ARG with reference types? For example:
void foo(QIODevice& obj)
{
QMetaObject::invokeMethod(this, "fooImpl", Q_ARG(QIODevice&, obj));
}
This code does not compile because the template type for QArgument is inferred to be QIODevice&, and the QArgument constructor wants a pointer to this type (something like QIODevice&*). Is there a way around this other than simply not using reference types?