Qt World Summit: Submit your Presentation

How to delete/remove screen/page from the display?

  • I have one Loader using which i am loading the multiple screen/pages.

    I have around 10 QML screen/pages which i am loading in the loader one by one on mouse events.

    On some of the screens i need to set transparency using "QWidget::setMask()" function to make some part of the screen/page make transparent.

    I am doing set mask from CPP code using "QWidget::setMask()" on the rootObject, which is Loader screen.

    QWidget::setMask is working perfectly, but masked area displays previously loaded screen/page.

    So i have the question, Is Loader Element properly deletes/removes the loaded component from the display before loading the new screen/page in the Loader, as mentioned in documents "http://doc.qt.nokia.com/4.7-snapshot/qml-loader.html":here.

    Also there are two function named "Component.onDestroyed:" and "Component.onDestruction:"
    When i Load new screen/page in the Loader "onDestruction" event is getting fired for the Loaded screen.

    What i want is, I want to completely remove/destroy the screen/page from the display once we load new page in the loader.
    I have also tried to set the visibility and opacity of the previously loaded screen, but still i am able to see the Previously loaded screen/page in the masked area.


  • Hi,

    I think that you don`t actualy see old page, but it is just artefacts left from previous widget drawings. If you have compositing, try "this":http://doc.qt.nokia.com/stable/qwidget.html#creating-translucent-windows . Unfortunatly, my Kubuntu instalation is broken and I can't test anything that requires video driver, so I can just give suggestions.

  • Actually it has some timing issues, to make it work we need to delay the process of setting new source to the Loader, for that we need to first set it to 'undefined' and set timer of around 200 ms and when timer triggers then we need to set the new source and then we have to call setMask on this top level window. if we do all this without using timer then after masking we can see the previous screen. I think QT needs some time to remove/clear the loaded screen/page in the Loader Element before loading new page.

Log in to reply