Moved GraphicsWindowQt from osgviewerQtContext into osgQt.
This commit is contained in:
parent
c4fded0629
commit
eb9510eb72
@ -1,7 +1,5 @@
|
||||
SET( TARGET_SRC
|
||||
GraphicsWindowQt
|
||||
GraphicsWindowQt.cpp
|
||||
osgviewerQtContext.cpp
|
||||
osgviewerQtContext.cpp
|
||||
)
|
||||
|
||||
IF( QT4_FOUND )
|
||||
@ -12,4 +10,7 @@ ELSE( QT4_FOUND )
|
||||
ENDIF( QT4_FOUND )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgWidget osgQt)
|
||||
|
||||
SETUP_EXAMPLE( osgviewerQtContext )
|
||||
|
@ -1,12 +1,17 @@
|
||||
#include <QtCore/QTimer>
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QGridLayout>
|
||||
|
||||
#include <osgViewer/CompositeViewer>
|
||||
#include <osgViewer/ViewerEventHandlers>
|
||||
|
||||
#include <osgGA/TrackballManipulator>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
|
||||
#include <osgQt/GraphicsWindowQt>
|
||||
|
||||
#include <iostream>
|
||||
#include "GraphicsWindowQt"
|
||||
|
||||
class ViewerWidget : public QWidget, public osgViewer::CompositeViewer
|
||||
{
|
||||
@ -44,7 +49,7 @@ public:
|
||||
view->addEventHandler( new osgViewer::StatsHandler );
|
||||
view->setCameraManipulator( new osgGA::TrackballManipulator );
|
||||
|
||||
GraphicsWindowQt* gw = dynamic_cast<GraphicsWindowQt*>( camera->getGraphicsContext() );
|
||||
osgQt::GraphicsWindowQt* gw = dynamic_cast<osgQt::GraphicsWindowQt*>( camera->getGraphicsContext() );
|
||||
return gw ? gw->getGraphWidget() : NULL;
|
||||
}
|
||||
|
||||
@ -65,7 +70,7 @@ public:
|
||||
traits->samples = ds->getNumMultiSamples();
|
||||
|
||||
osg::ref_ptr<osg::Camera> camera = new osg::Camera;
|
||||
camera->setGraphicsContext( new GraphicsWindowQt(traits.get()) );
|
||||
camera->setGraphicsContext( new osgQt::GraphicsWindowQt(traits.get()) );
|
||||
|
||||
camera->setClearColor( osg::Vec4(0.2, 0.2, 0.6, 1.0) );
|
||||
camera->setViewport( new osg::Viewport(0, 0, traits->width, traits->height) );
|
||||
|
@ -20,7 +20,12 @@
|
||||
#include <QtGui/QInputEvent>
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
|
||||
class GraphWidget : public QGLWidget
|
||||
#include <osgQt/Export>
|
||||
|
||||
namespace osgQt
|
||||
{
|
||||
|
||||
class OSGQT_EXPORT GraphWidget : public QGLWidget
|
||||
{
|
||||
public:
|
||||
GraphWidget( const QGLFormat& format, QWidget* parent=0, const QGLWidget* shareWidget=0, Qt::WindowFlags f=0 );
|
||||
@ -42,7 +47,7 @@ protected:
|
||||
osgViewer::GraphicsWindow* _gw;
|
||||
};
|
||||
|
||||
class GraphicsWindowQt : public osgViewer::GraphicsWindow
|
||||
class OSGQT_EXPORT GraphicsWindowQt : public osgViewer::GraphicsWindow
|
||||
{
|
||||
public:
|
||||
GraphicsWindowQt( osg::GraphicsContext::Traits* traits );
|
||||
@ -88,4 +93,7 @@ protected:
|
||||
bool _realized;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -17,6 +17,7 @@ QT4_WRAP_CPP( SOURCES_H_MOC ${SOURCES_H} OPTIONS "-f" )
|
||||
|
||||
SET(LIB_PUBLIC_HEADERS
|
||||
${HEADER_PATH}/Export
|
||||
${HEADER_PATH}/GraphicsWindowQt
|
||||
${HEADER_PATH}/QFontImplementation
|
||||
${HEADER_PATH}/QGraphicsViewAdapter
|
||||
${HEADER_PATH}/QWidgetImage
|
||||
@ -28,6 +29,7 @@ SET(LIB_PUBLIC_HEADERS
|
||||
ADD_LIBRARY(${LIB_NAME}
|
||||
${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC}
|
||||
${LIB_PUBLIC_HEADERS}
|
||||
GraphicsWindowQt.cpp
|
||||
QFontImplementation.cpp
|
||||
QGraphicsViewAdapter.cpp
|
||||
QWidgetImage.cpp
|
||||
|
@ -11,7 +11,10 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include "GraphicsWindowQt"
|
||||
#include <osgQt/GraphicsWindowQt>
|
||||
|
||||
namespace osgQt
|
||||
{
|
||||
|
||||
GraphWidget::GraphWidget( const QGLFormat& format, QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f )
|
||||
: QGLWidget(format, parent, shareWidget, f)
|
||||
@ -340,3 +343,5 @@ void GraphicsWindowQt::requestWarpPointer( float x, float y )
|
||||
if ( _widget )
|
||||
QCursor::setPos( _widget->mapToGlobal(QPoint((int)x,(int)y)) );
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user