Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

[solved] Flickable: Items added from C++ not moving

$
0
0
Hi, I am trying to add items from a c++ method to a Flickable component. Everything is working so far, but the newly added items don’t move when flicking. Items added via qml behave as expected. The items from c++ are added statically at the position defined in the code. When debugging the c++ items appear as children of the qml Flickable. An excerpt from the code:     QQmlComponent event_component(qmlContext(ui_timeline)->engine(), QUrl("qrc:/Event.qml"));       int event_count = model_events->rowCount(QModelIndex());     int timeline_width = (event_count - 1) * window_width + window_width;     ui_timeline->setProperty("contentWidth", timeline_width);       for(int i=0; i<event_count; i++) {         QQuickItem *event_view = qobject_cast<QQuickItem*>(event_component.create(qmlContext(ui_timeline)));         event_view->setParentItem(ui_timeline);         event_view->setX(130*i);         event_view->setY(window_height/2 - event_view->height()/2 - 16);     } ui_timeline represents the Flickable event_view the added items from a qml file Is there anything wrong in the way I’m adding the items to Flickable? best regards

Viewing all articles
Browse latest Browse all 4972

Trending Articles