hi,
thanks for elaborating
while I was trying to implement I found that VisualItemModel is not suggested to be used for dynamic objects/widgets. please correct me if I am wrong.put both items into a VisualItemModel and use a ListView
Also, I can not put them all in a list as going forward we might be having multiple dynamic screens(some widgets as well), which will be generated at various stages.
And I was able to animate it. my one widget is sliding out of screen and another entering in. Below is the working code for the same.
QQuickWidget *mQQuickWidget1 = new QQuickWidget();
mQQuickWidget1->setSource(QUrl("qrc:/qml/res/layouts/AndroidDelegate.qml"));
ui->verticalLayout->addWidget(mQQuickWidget1);
//ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1,mQQuickWidget1);
/*animate first widget*/
QPropertyAnimation *animation1 = new QPropertyAnimation(mQQuickWidget,"geometry");
QRect pixEnd1 = QRect(QPoint(mQQuickWidget->width(),0), mQQuickWidget->size());
QRect pixStart1 = QRect(QPoint(0,0), mQQuickWidget->size());
animation1->setDuration(5000);
animation1->setStartValue(pixStart1);
animation1->setEndValue(pixEnd1);
animation1->start();
QPropertyAnimation *animation = new QPropertyAnimation(mQQuickWidget1,"geometry");
QRect pixEnd = QRect(QPoint(0,0), mQQuickWidget1->size());
QRect pixStart = QRect(QPoint(-(mQQuickWidget->width()),0), mQQuickWidget1->size());
animation->setDuration(5000);
animation->setStartValue(pixStart);
animation->setEndValue(pixEnd);
animation->start();
But still there is a problem:
as soon as the widget is created and before the animation starts it shows up for faction of seconds and then enters with animation.
I want to get rid of this initial showup of the widget, please help![]()
Bookmarks