Search code examples
qtqmlqtquick2qt-quick

How to improve QQuickView refresh


I have a application different mix UI : QWidget::createWindowContainer() for QML with QQuickView And QWidget

When I try to create transition ( animation ) of my QWidget which content my QQuickView, the transition is not very smooth ...

Here my code summarized :

QQuickView *myQuickView = new QQuickView("myqml")
QState *mMenuStateHidden = new QState();
QState *mMenuStateVisible = new QState();

QStateMachine *mMachine = new QStateMachine();
mMachine->addState(mMenuStateHidden);
mMachine->addState(mMenuStateVisible);
mMahine->setInitialState(mMenuStateHidden);

mGSlideMenu = QWidget::createWindowContainer(myQuickView);

mMenuStateHidden->assignProperty(mGSlideMenu, "geometry", QRectF(QPointF(-mGSlideMenu->width(), height()),mGSlideMenu->size()));
mMenuStateVisible->assignProperty(mGSlideMenu, "geometry", QRectF(QPointF(0, height()),mGSlideMenu->size()));

QPropertyAnimation *lAnimOut = new QPropertyAnimation(mGSlideMenu, "geometry");


QSignalTransition *transition = mMenuStateHidden->addTransition(myQuickView->rootObject(), SIGNAL(menuClicked()), mMenuStateVisible);
        transition->addAnimation(lAnimIn);

QSignalTransition* transition2 = mMenuStateVisible->addTransition(myQuickView->rootObject(), SIGNAL(menuClicked()), mMenuStateHidden);
        transition2->addAnimation(lAnimOut);

mMahine->start();

How you can see, in the left of the gif, there are a "black" artifact; which is not there we the QML is not loaded.

In the Left

So my question is, how I can improve my QQuickView to have a application with a better smooth.

Thx guys,


Solution

  • I fixed my issue in using a QQuickWidget instead QQuickView. Everything is ok now.

    Thx !