QQuickWindow rendering in background



  • I need constantly render my own graphics in QQuickWindow. I have a component inherited from QItem to do this. The rendering is performing when I catch a signal from the QQuickWindow.

            connect(win, SIGNAL(beforeRendering()), this, SLOT(paint()), Qt::DirectConnection);
    

    When the window is visible and is not minimized then all is Ok. But when the window is in the background or minimized the signal beforeRendering() is not emitted, so I can't render my graphics.
    This problem is actual only in Windows and MacOS. In ubuntu the rendering in backgound is Ok too.
    How can I resolve this issue?


  • Moderators

    Hi, and welcome to the Qt forum!
    The issue is actually that Ubuntu still renders the content even when the window is not visible. That's a waste of GPU ressources.



  • @Wieland
    Thanks for your answer. I realize that. But is it possible to enable emitting signal beforeRendering() from QQuickWindow in background? Because it is the shortest way to my purposes.


  • Moderators

    I'm pretty sure there is no ootb solution to do that. Why do you want to render the background when it's not possible? Maybe we can find another solution.



  • @Wieland said:

    I'm pretty sure there is no ootb solution to do that. Why do you want to render the background when it's not possible? Maybe we can find another solution.

    This is because I have a real-time video streaming and the frames are rendering in main QQuickWindow context. I think otherwise I need to create another opengl context and run rendering in it. Or maybe there is some way to use the same QQuickWindow context to do that?



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.