Hello,

QMetaObject::invokeMethod fails while all the types registered.

class A : public QObject
{
Q_OBJECT
public:

struct B {...};

public slot:

void test(const B&);

};

Q_DECLARE_METATYPE(A::B)

*.cpp part*:

A::A()
{
    qRegisterMetaType<A::B>("A::B");

}

void A::test(const B& b)
{

    if (QThread::currentThread() != thread())

    {


        bool ok = QMetaObject::invokeMethod(this,

                                            "test",

                                            Q_ARG(const B &, b));

        Q_ASSERT(ok); // GETTING ASSERTION FAILURE HERE

        return;

    }

}

Actually, in my real app, the method has 3 parameters. It had 2 and invokeMethod worked fine.

I added new structure and added it as 3d parameters - it stopped working.

Solution that helped me - I moved the structure outside of the class.

Is it a bug of something on my side?


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to