Home > Software design >  Qt Create Qquickwindow with Qquickrendercontrol in another thread
Qt Create Qquickwindow with Qquickrendercontrol in another thread

Time:07-23

I'm developing an application based on qt quick that has 2 windows. One is the Gui and the other one is a non interactive window that receives data from Gui window and runs its own render loop.

The goal is for the non interactive window to not be interrupted by the main thread.

My main thread Gui is a Qquickwindow which loads qml.

My non interactive window is a Qquickwindow that has a rendertarget and a Qquickrendercontrol. According to the documentation there will be no native window created and I will have a render thread that will handle all the graphics commands and swap buffers to another window that does not receive any input (can't be interacted with)

My issue is that still needs to communicate with the Gui main thread and if the main thread is busy for some reason then there will be no updates to my render thread.

How can I create a Qquickwindow in another thread. Qquickwindow seems to set up some connects that fail if created in another thread, but there should be a way since there is no actual window being created that needs loop handler.

CodePudding user response:

I ended up doing a multiprocess. With QLocalSocket and QQLocalServer for communication. I also was able to share the texture created in the non interactive application ( D3D11_RESOURCE_MISC_SHARED_KEYEDMUTEX | D3D11_RESOURCE_MISC_SHARED_NTHANDLE) And opening in the interactive window to display a preview as well.

  • Related