[osg-users] [3rdparty] Combining OSG and Qt 5.4 architecture

Christian Kunz christian.kunz83 at gmail.com
Wed Apr 15 01:38:22 PDT 2015

Hello everyone,

I have a question regarding the combination of OSG and Qt 5.4.
I already combined my OSG application with Qt. I used the example which is shipped with OSG: "osgviewerQt".
At the moment my OSG application is quite simple. Its a 3D scene with a animated 6 axis robot.

I added my root node as explained in the example:

    QApplication app( argc, argv );
    osgQt::GraphicsWindowQt* gw = createGraphicsWindow( 50, 50, 640, 480 );

    //osg::Node* scene = osgDB::readNodeFile("cow.osg");
    osg::Node* scene = root;

    ViewerWidget* widget = new ViewerWidget(gw, scene);
    widget->setGeometry( 100, 100, 800, 600 );
    return app.exec();

Then my scene is rendered in a Qt Widget.

The problem with this solution is, that it is not a Qt mainWindow. Is there a way to add this ViewerWidget which is inherited from QWidget to a normal Qt form?
The best would be that you can see a placeholder in the forms editor of Qt creator. Does anyone know an example which is more complex than "osgviewerQt"?

Thank you!


Read this topic online here:

More information about the osg-users mailing list