Hi and welcome to devnet,
MyWidget.h
class MyWidget : public QWidget
{
Q_OBJECT
public:
MyWidget(QWidget *parent = 0);
Q_INVOKABLE QWidget* me() { return this; }
};
main.cpp
MyWidget widget;
QWidget *retVal = Q_NULLPTR;
QMetaObject::invokeMethod(&widget, "me", Qt::DirectConnection,
Q_RETURN_ARG(QWidget*, retVal));
qDebug() << retVal;
Returns the right value.
Can you show your current function code and how you call it exactly ?
↧








