|
发表于 2008-2-26 22:47:21
|
显示全部楼层
不妨把osgviewerQT的例子这样改造一下:- class MyWidget : public QWidget
- {
- public:
- MyWidget(QWidget *parent = 0)
- {
- setGeometry(100, 100, 800, 600);
- osg::ref_ptr<osg::Node> loadedModel = osgDB::readNodeFile("axes.osg");
- viewerWindow = new ViewerQT;
- viewerWindow->setCameraManipulator(new osgGA::TrackballManipulator);
- viewerWindow->setSceneData(loadedModel.get());
- QHBoxLayout *mainLayout = new QHBoxLayout;
- mainLayout->addWidget(viewerWindow);
- setLayout( mainLayout );
- }
- protected:
- ViewerQT* viewerWindow;
- };
- int mainAdapterWidget(QApplication& a, osg::ArgumentParser& arguments)
- {
- MyWidget* widget = new MyWidget();
- widget->show();
-
- a.connect( &a, SIGNAL(lastWindowClosed()), &a, SLOT(quit()) );
- return a.exec();
- }
复制代码 也就是把viewerQT实例封到一个Layout里面,然后再向Layout追加别的控件:按钮、编辑框之类的就成了~~我用的QWidget,楼主用QMainWindow是一样的 |
|