QGraphicsView/QGraphicsScene with custom DirectX viewport



  • Hello,

    I am trying to set up DirectX rendering within Qt using a custom QWidget as the viewport for my QGraphicsView. To do this, I am setting up the DirectX device to render on the QGraphicsView::winId() - the HWND. I am also assigning a custom QGraphicsScene to the view, and I am overriding the QGraphicsScene::drawBackgound() routine to paint custom items to the scene.

    The problem I am facing seems to look like the QGraphicsScene's QPainter is drawing over the top of the DirectX device's rendering on the assigned HWND. I see a flickering effect where I see the two conflicting with each other when I resize my window (or the drawBackground() routine is called due to an update). Some sort of window composition problem maybe...

    Has anyone successfully been able to render with a DirectX device in conjunction with a QGraphicsView/QGraphicsScene where they can behave properly within the same window? If so, or you know how to do so, are there any steps that I am missing? Would you be willing to share some sample source code? I could share what I have so far if I could get someone to help troubleshoot.

    Background info: I'm developing an SDK which will allow the user to choose whether to render using OpenGL or DirectX. We want to give users the ability have that option. I have OpenGL working, of course, because the QGLWidget handles it correctly out of the box. I also want the user to have the flexibility to overlay items of top of the QGraphicsScene. This is why I'm attempting with the QGraphicsView/QGraphicsScene approach.

    Thanks all, and I appreciate any help that I can get.



  • Any advice?


Log in to reply
 

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