Subclassing QQuickItem
-
I want to subclass QQuickItem and Create my own Item.
Currently i have a class that has a QQuickItem which has the following code in the constructor, but i want the class itself to be a QQuickItem
QQmlComponent component(parent->engine(), QUrl(QStringLiteral("qrc:/Bullet.qml")));
Item = qobject_cast<QQuickItem*>(component.create());
Item->setParentItem(parent->rootObject());Item is QQuickItem*
-
@AhmedYossef Yes you can do that. You will need to re-implement updatePaintNode for the drawing stuff. But be aware that painting in
QQuickItem
is more complicated. Have a look at this example.