//mainwindow.cpp
void MainWindow ::addNewImage()
{
QQuickWidget *mQQuickWidget1 = new QQuickWidget();
//QWidget *container1 = QWidget::createWindowContainer(view1,this );
mQQuickWidget1
->setSource
(QUrl("qrc:/qml/res/layouts/AndroidDelegate.qml"));
ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1,mQQuickWidget1,0,Qt::AlignCenter);
/*newly added code for animation*/
QPropertyAnimation *animation = new QPropertyAnimation(mQQuickWidget1,"pos",this);
pix.
moveCenter(QPoint(width
()/2,
0));
animation->setDuration(2000);
animation
->setStartValue
(QPoint(-(mQQuickWidget1
->width
()),mQQuickWidget1
->x
()));
animation
->setEndValue
(QPoint(pix.
y(),mQQuickWidget1
->x
()));
// animation->easingCurve(QEasingCurve::OutBounce);
animation->start();
mQQuickWidget->hide();
}
//mainwindow.cpp
void MainWindow ::addNewImage()
{
QQuickWidget *mQQuickWidget1 = new QQuickWidget();
//QWidget *container1 = QWidget::createWindowContainer(view1,this );
mQQuickWidget1->setSource(QUrl("qrc:/qml/res/layouts/AndroidDelegate.qml"));
ui->verticalLayout->insertWidget(ui->verticalLayout->count() - 1,mQQuickWidget1,0,Qt::AlignCenter);
/*newly added code for animation*/
QPropertyAnimation *animation = new QPropertyAnimation(mQQuickWidget1,"pos",this);
QRect pix = QRect(QPoint(0,0), mQQuickWidget1->size());
pix.moveCenter(QPoint(width()/2,0));
animation->setDuration(2000);
animation->setStartValue(QPoint(-(mQQuickWidget1->width()),mQQuickWidget1->x()));
animation->setEndValue(QPoint(pix.y(),mQQuickWidget1->x()));
// animation->easingCurve(QEasingCurve::OutBounce);
animation->start();
mQQuickWidget->hide();
}
To copy to clipboard, switch view to plain text mode
Bookmarks