I have a QQuickItem
derived class like below
class MyQQuickItem : public QQuickItem
{
Q_OBJECT
public:
MyQQuickItem(QQuickItem *parent = 0);
~ MyQQuickItem();
QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
};
I have my own TextureNode
class as well.
I have MyQQuickItem
registered on QML side & embedded in main.qml
like below.
MyQQuickItem {
id: my_quick_item
objectName: "MyQQuickItemObject"
visible: false
width: 500
height: 500
}
On the trigger of a certain signal, that I have connected to a slot in MyQQuickItem
, I call this->update()
. This of course triggers updatePaintNode
& I am able to repaint my MyQQuickItem
with new content I want.
Is it possible to trigger updatePaintNode
on a QQuickItem
without declaring it at all in a qml file?
I want to dynamically create my MyQQuickItem
at C++ level & not have it defined or declared at all in main.qml
How can I do this?
Core question: How can I create a QQuickItem purely at C++ level which is updatable with new content by calling update on it so that updatePaintNode is fired?
Update:
I am able to create a QQuickItem
in the following way.
QQuickView * view = new QQuickView;
view->setSource(QUrl(QStringLiteral("qrc:/MyQQuickItem.qml")));
QQuickItem * myquickitem_object = view->rootObject();
But the problem is that I cant get updatePaintNode
to fire when I call this->update
. What should I do get the my QQuickItem
to update itself?