Qt World Summit: Submit your Presentation

Android: draw qml in SurfaceView with ZOrderMediaOverlay

  • Hi all,

    I have an application on android with a QQuickView with transparent background which draw some qml and a pure android SurfaceView which is supposed to display a video in background.

    At startup, everything is good. My video is playing in background and my qml components are displayed in foreground.

    My problem is when my activity is paused then resume, every time the video is displayed on top from my qml.
    After research I think it's because the SurfaceView created by Qt to display the qml and my SurfaceView created to display the video are in the same "z area". So the render order is undefined.

    I would like move the Qt SurfaceView to the ZOrderMediaOverlay area by setting the ZOrderMediaOverlay to true but I have to set it at SurfaceView creation.

    Is there a way to set my z order directly from c++ when I create my QQuickView ?
    Or is there another way ?

    I have a custom activity which inherits from QtActivity, but the SurfaceView is not created yet in the onCreate function.
    I can access to the Qt SurfaceView when I create my SurfaceView for video but the Qt's one is already created and set the ZOrderMediaOverlay has no effect.

    Thanks a lot for your help :)

Log in to reply