moc: Generate qt_static_metacall for creatable-only gadgets
Prior to this, moc would not generate the function unless the gadget class had a property or a non-constructor invokable. Change-Id: Ic020ea5f8f59702f5e9e194a46e26850e53e5cfe Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
This commit is contained in:
parent
d6efc6b543
commit
629f5a46d5
@ -448,7 +448,8 @@ void Generator::generateCode()
|
|||||||
// Generate internal qt_static_metacall() function
|
// Generate internal qt_static_metacall() function
|
||||||
//
|
//
|
||||||
const bool hasStaticMetaCall = !isQt &&
|
const bool hasStaticMetaCall = !isQt &&
|
||||||
(cdef->hasQObject || !cdef->methodList.isEmpty() || !cdef->propertyList.isEmpty());
|
(cdef->hasQObject || !cdef->methodList.isEmpty()
|
||||||
|
|| !cdef->propertyList.isEmpty() || !cdef->constructorList.isEmpty());
|
||||||
if (hasStaticMetaCall)
|
if (hasStaticMetaCall)
|
||||||
generateStaticMetacall();
|
generateStaticMetacall();
|
||||||
|
|
||||||
|
@ -90,13 +90,15 @@ struct QTBUG_31218_Derived : QTBUG_31218<-1<0> {};
|
|||||||
class CreatableGadget
|
class CreatableGadget
|
||||||
{
|
{
|
||||||
Q_GADGET
|
Q_GADGET
|
||||||
Q_PROPERTY(int a MEMBER a)
|
|
||||||
public:
|
public:
|
||||||
Q_INVOKABLE CreatableGadget() : a(0xdeadbeef) { }
|
Q_INVOKABLE CreatableGadget()
|
||||||
|
{
|
||||||
int a;
|
CreatableGadget::qt_static_metacall((QObject*)this, QMetaObject::ReadProperty, -1, Q_NULLPTR);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CreatableGadget creatableGadget; // Force the compiler to use the constructor
|
||||||
|
|
||||||
struct MyStruct {};
|
struct MyStruct {};
|
||||||
struct MyStruct2 {};
|
struct MyStruct2 {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user