Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Qt 5.4 and OpenSceneGraph
Qt 6.11 is out! See what's new in the release blog

Qt 5.4 and OpenSceneGraph

Scheduled Pinned Locked Moved 3rd Party Software
openscenegraph
1 Posts 1 Posters 3.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    Fawkes
    wrote on last edited by
    #1

    Hi everyone,
    I am using Qt5.4 in combination with OpenSceneGraph 3.2.

    What I want is to use Qt as the Windowing System. There is also an example under: https://github.com/xarray/osgRecipes/blob/master/cookbook/chapter9/ch09_01/osg_qt.cpp

    I used this and it is working quite well. I have my OpenSceneGraph Scene rendered in a QtWidget:

     osgQt::GraphicsWindowQt* gw = createGraphicsWindow( 50, 50, 640, 480 );
     //osg::Node* scene = osgDB::readNodeFile("cow.osg");
     osg::Node* scene = root;
    ViewerWidget* widgetOSG = new ViewerWidget(gw, scene);
    widgetOSG->setGeometry( 100, 100, 800, 600 );
    widgetOSG->show();
    

    In my code I used my root node which holds an animated 3d robot. This is working fine.

    My problem now is that I want to use the QWidget inside a MainWindow and I just don´t get this to work.
    The code I am using right now is;

    widgetOSG->setParent(ui->widget);
    ui->widget->show();
    

    The whole code I posted is in my sourceFile from the MainWindow.cpp . I just used the standard MainWindow that
    Qt Creator is creating when a new Qt Project is set up. widgetOSG is just a QWidget I created in the forms editor.

    It looks like the scene is loaded into that QWidget. But I can´t see it.
    One thing the compiler says is:

    QWindowsWindow::setGeometryDp: Unable to set geometry 22x22+640+280 on QWidgetWindow/'QWidgetClassWindow'. Resulting geometry:  124x22+640+280 (frame: 8, 31, 8, 8, custom margin: 0, 0, 0, 0, minimum size: 22x22, maximum size: 16777215x16777215).
    

    I appreciate any help.

    Thanks
    Chris

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved