I need to create QQuickText in C++. I use this code:
QQmlType *type = QQmlMetaType::qmlType("QtQuick/Text", 2, 0);
if (type)
{
QObject *obj = type->create();
QQuickItem *item = qobject_cast<QQuickItem*>(obj);
qDebug() << item;
}
It work, but I had to include <private/qqmlmetatype_p.h>. There is another way?
↧