[Interest] Qt metatypes bug?
Alexander Dyagilev
alervdvcw at gmail.com
Sat Nov 12 09:20:08 CET 2016
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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20161112/9cd63ced/attachment.html>
More information about the Interest
mailing list