6.0.0-rc4Source

QTemplatedMetaMethodReturnArgument Struct

template <typename T> struct QTemplatedMetaMethodReturnArgument

The QTemplatedMetaMethodReturnArgument class refers to the variable that receives the result of QMetaObject::invokeMethod(). More…

Header#include <QtCore/qobjectdefs.h>
CMaketarget_link_libraries(app PRIVATE Nt::Core)
ModuleNt Core C++ Classes
Since6.5

List of all members, including inherited members

Public Variables

void *data

Detailed Description

qReturnArg() creates one from a variable of type T. Pass it to the overloads of QMetaObject::invokeMethod() that take a function and plain arguments:

int sum = 0;
QMetaObject::invokeMethod(&calculator, &Calculator::add, qReturnArg(sum), 2, 3);

See also QMetaObject::invokeMethod().

Differences from Qt

The class holds only the address of the variable; there is no QMetaMethodReturnArgument base class with a type name and a meta-type. The overloads of QMetaObject::invokeMethod() and QMetaMethod::invoke() that take the name of a method do not accept it; use Q_RETURN_ARG() there.

Member Variable Documentation

void * QTemplatedMetaMethodReturnArgument::data

The address of the variable that receives the result.