Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How the QGraphicsView add QGLwidget and shows in Qmainwindow?



  • I wan to show 2D graphic view Item and open scene graph in the QGraphicsView , I have tried some open source code ,and it works ,when I setviewport() and drawbackground() the 3D graphics can show well in QGraphicsScene. I wan to show this in mainwindow it not work , when I chande the QGraphicsScene.show() behind the mainwindow.show() it can works well ,but this is not I want .



  • the code
    ![alt text](0_1548064172622_dce76c90-4018-4f64-be1d-19dfd90862e5-image.png image url)

    running as two window
    ![alt text](0_1548064135465_45e63a8b-ae61-43aa-acd7-09645ed3f493-image.png image url)


  • Lifetime Qt Champion

    Hi,

    And how are you using that QGraphicsScene in your "mainwindow" ?

    Note that in the code you show, there's no mainwindow object.


Log in to reply