How to repaint QWidget encapsulated in QDeclarativeItem in QML?
-
@Chillax Unfortunately I too dont understand this behavior. The fact that it works in desktop environment and not on embedded only points that there should be some bug in that environment.
So now my plan is to give the flow value from C++ to the FlowGrafik QML item, and then call addFlow from QML.
Try. I had suggested the same earlier :)
Let us know if it works or if possible the exact reason so that it may help others too. -
@p3c0 So thanks a lot for the help! I would have given up without you :) The problem was that I created two instances of
FlowGrafik
. One in the QML and one in C++. I changed the C++ one and expected the QML one to refresh.Now I created a pointer in the C++ code that points to the Item in the QML.
QmlApplicationViewer flowView; flowView.setSource(QUrl("qrc:///qml/qml/FlowView.qml")); QObject * flowViewObject = flowView.rootObject(); FlowGrafik * flowGrafik = flowViewObject->findChild<FlowGrafik *>(QString("FlowGrafik"));
But now if I want to use this pointer (like
flowGrafik->addFlow(...)
) I get a segmentation fault. Do you know why? -
@Chillax Thank you :)
The problem was that I created two instances of FlowGrafik. One in the QML and one in C++. I changed the C++ one and expected the QML one to refresh.
but now this makes me wonder as to why it worked on desktop.
But now if I want to use this pointer (like flowGrafik->addFlow(...)) I get a segmentation fault. Do you know why?
Was the
FlowGrafik
object found ? You can add a small condition to verify it.if(flowGrafik) { flowGrafik->addFlow(...) }