管理员
兴趣点(最多三项):
视景仿真
地形仿真
高层游戏引擎
- 私信
|
发表时间 : 2018-1-2 12:38:23
|
浏览 : 3949 评论 : 1
1 Q3DVIEW.h
- #ifndef Q3DVIEW_H
- #define Q3DVIEW_H
- #include <QGLWidget>
- #include <QResizeEvent>
- #include <QtWidgets/QGraphicsView>
- #include <osgQt/GraphicsWindowQt>
- #include <QInputEvent>
- #include <QGraphicsScene>
- #include <qgraphicsscene.h>
- #include <QGraphicsSceneEvent>
- #include <osgViewer/Viewer>
- #include <osgViewer/ViewerEventHandlers>
- class Q3DView :public osgQt::GLWidget, public osgViewer::Viewer
- {
- Q_OBJECT
- public:
- Q3DView(QWidget *parent = NULL);
- ~Q3DView(void);
- osg::GraphicsContext* GetGraphicsContext();
- virtual void paintEvent( QPaintEvent* event );
- virtual void resizeEvent( QResizeEvent* event );
- };
- #endif // QOSGVIEW_H
复制代码
2 该类的使用方法:
1)新建对象:
mViewer = new Q3DView();
2)获取窗口对象:
QWidget *DCECore::getView()
{
return mViewer;
}
3)加入到主窗口
QHBoxLayout *topLayout = new QHBoxLayout(ui->page_1); m_DCECore = new DCECore(url); topLayout->addWidget(m_DCECore->getView());
|
|