Hi,
attached you find a patch adding the QT4 support to the OpenSG cmake
build system. So you don't need to start from scratch in case you start
porting the QT4 stuff someday.
The patch also adds the OSGQ4GLWindow from OpenSG 1.8 code.
Cheers,
Christoph
Index: CMake/BuildFunctions.cmake
===================================================================
--- CMake/BuildFunctions.cmake (revision 1708)
+++ CMake/BuildFunctions.cmake (working copy)
@@ -385,9 +385,23 @@
ENDIF(OSG_ENABLE_FCD2CODE AND PYTHONINTERP_FOUND)
############
- # Flex/Bison
+ # Qt4
############
+
+ IF(${PROJ_DEFINE} STREQUAL "OSG_COMPILEWINDOWQT4LIB")
+
+ SET(QT4_MOC_HEADERS ${${PROJECT_NAME}_HDR})
+
+ QT4_WRAP_CPP(QT4_MOC_SOURCES ${QT4_MOC_HEADERS})
+
+ LIST(APPEND ${PROJECT_NAME}_SRC ${QT4_MOC_SOURCES})
+ ENDIF(${PROJ_DEFINE} STREQUAL "OSG_COMPILEWINDOWQT4LIB")
+
+ ############
+ # Flex/Bison
+ ############
+
IF(OSG_ENABLE_SCANPARSE_REGEN AND FLEX_EXE AND BISON_EXE)
FOREACH(YYFile ${${PROJECT_NAME}_YY})
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 1708)
+++ CMakeLists.txt (working copy)
@@ -357,7 +357,22 @@
OSG_SET(OSG_GLUT_INC_DIR)
OSG_SET(OSG_GLUT_LIBS)
ENDIF(GLUT_FOUND)
+
+ #############
+ #### QT
+ #############
+ OSG_FIND_PACKAGE(QT4)
+
+ IF(QT4_FOUND)
+ OSG_SET(OSG_WITH_QT 1)
+ OSG_SET(OSG_QT4_INC_DIR ${QT_INCLUDE_DIR})
+ OSG_SET(OSG_QT4_LIBS ${QT_LIBRARY_DIR})
+ ELSE(QT4_FOUND)
+ OSG_SET(OSG_QT4_INC_DIR)
+ OSG_SET(OSG_QT4_LIBS)
+ ENDIF(QT4_FOUND)
+
#############
#### OpenGL
#############
Index: Source/WindowSystem/QT4/CMakeLists.Lib.OSGWindowQT4.txt
===================================================================
--- Source/WindowSystem/QT4/CMakeLists.Lib.OSGWindowQT4.txt (revision 0)
+++ Source/WindowSystem/QT4/CMakeLists.Lib.OSGWindowQT4.txt (revision 0)
@@ -0,0 +1,54 @@
+
+PROJECT("OSGWindowQT4")
+
+OSG_ADD_PROJECT()
+
+IF(NOT QT4_FOUND)
+ MESSAGE(STATUS "Dependency (QT4) not found, can not build
(${PROJECT_NAME}).\n")
+ SET(OSGBUILD_${PROJECT_NAME} OFF)
+ENDIF(NOT QT4_FOUND)
+
+OSG_SELECT_PROJECT()
+
+##############################################################################
+# dependencies
+##############################################################################
+
+# dependencies - OpenSG
+SET(${PROJECT_NAME}_DEP_OSG_LIB OSGBase
+ OSGSystem
+ OSGWindow)
+SET(${PROJECT_NAME}_DEP_TEST_OSG_LIB OSGDrawable
+ OSGFileIO
+ OSGGroup
+ OSGImageFileIO
+ OSGState
+ OSGText
+ OSGUtil
+ OSGWindow)
+
+# dependencies - External
+SET(${PROJECT_NAME}_DEP_LIB QT4_LIBRARIES)
+# SET(${PROJECT_NAME}_DEP_LIBDIR)
+SET(${PROJECT_NAME}_DEP_INCDIR OSG_QT4_INC_DIR)
+
+# SET(${PROJECT_NAME}_DEP_TEST_LIB)
+# SET(${PROJECT_NAME}_DEP_TEST_LIBDIR)
+# SET(${PROJECT_NAME}_DEP_TEST_INCDIR)
+
+# dependencies - Additional
+# SET(${PROJECT_NAME}_DEP_ADD_INCDIR)
+
+OSG_STORE_PROJECT_DEPENDENCIES()
+
+##############################################################################
+# collect sources
+##############################################################################
+
+OSG_ADD_DIRECTORY("Source/WindowSystem/QT4")
+
+##############################################################################
+# setup build
+##############################################################################
+
+OSG_SETUP_PROJECT("OSG_COMPILEWINDOWQT4LIB")
Index: Source/WindowSystem/QT4/CMakeLists.txt
===================================================================
--- Source/WindowSystem/QT4/CMakeLists.txt (revision 0)
+++ Source/WindowSystem/QT4/CMakeLists.txt (revision 0)
@@ -0,0 +1,5 @@
+
+# CMake's ADD_SUBDIRECTORY only looks for CMakeLists.txt, so we include
+# the real file here
+
+INCLUDE("CMakeLists.Lib.OSGWindowQT4.txt")
Index: Source/WindowSystem/QT4/OSGQ4GLWidget_qt.cpp
===================================================================
--- Source/WindowSystem/QT4/OSGQ4GLWidget_qt.cpp (revision 0)
+++ Source/WindowSystem/QT4/OSGQ4GLWidget_qt.cpp (revision 0)
@@ -0,0 +1,147 @@
+/*---------------------------------------------------------------------------*\
+ * OpenSG *
+ * *
+ * *
+ * Copyright (C) 2000-2002 by the OpenSG Forum *
+ * *
+ * www.opensg.org *
+ * *
+ * contact: [email protected], [email protected], [email protected] *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * License *
+ * *
+ * This library is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Library General Public License as published *
+ * by the Free Software Foundation, version 2. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * Changes *
+ * *
+ * *
+ * *
+ * *
+ * *
+ * *
+\*---------------------------------------------------------------------------*/
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+
+#ifdef OSG_WITH_QT
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "OSGConfig.h"
+
+#include "OSGQ4GLWidget_qt.h"
+
+OSG_USING_NAMESPACE
+
+/*! \class osg::QTWindow
+
+The class for QT-based windows. See \ref PageWindowQT for a description.
+
+*/
+
+/***************************************************************************\
+ * Instance methods *
+\***************************************************************************/
+
+/*-------------------------------------------------------------------------*\
+ - public -
+\*-------------------------------------------------------------------------*/
+
+/*------------- constructors & destructors --------------------------------*/
+
+/*! Constructor
+*/
+
+
+OSGQGLWidget::OSGQGLWidget( QWidget *parent, const char *name,
+ const QGLWidget * shareWidget, Qt::WFlags f ) :
+ QGLWidget( parent, shareWidget, f )
+{
+}
+
+OSGQGLWidget::OSGQGLWidget( const QGLFormat & format,
+ QWidget *parent, const char *name,
+ const QGLWidget * shareWidget, Qt::WFlags f
+ ) :
+ QGLWidget( format, parent, shareWidget, f )
+{
+}
+
+
+/*! Destructor
+*/
+
+OSGQGLWidget::~OSGQGLWidget( void )
+{
+}
+
+
+/*------------------------------ access -----------------------------------*/
+
+void OSGQGLWidget::initializeGL(void)
+{
+}
+
+void OSGQGLWidget::paintGL(void)
+{
+}
+
+void OSGQGLWidget::resizeGL(int, int)
+{
+}
+
+void OSGQGLWidget::makeCurrent(void)
+{
+}
+
+void OSGQGLWidget::swapBuffers(void)
+{
+}
+
+#ifdef __sgi
+#pragma set woff 1375
+#endif
+
+#include "OSGQ4GLWidget_qt_moc.cpp"
+
+#ifdef __sgi
+#pragma reset woff 1375
+#endif
+
+/*-------------------------------------------------------------------------*/
+/* cvs id's */
+
+#ifdef __sgi
+#pragma set woff 1174
+#endif
+
+#ifdef OSG_LINUX_ICC
+#pragma warning( disable : 177 )
+#endif
+
+namespace
+{
+ static char cvsid_cpp[] = "@(#)$Id: OSGQ4GLWidget_qt.cpp,v 1.1 2006/03/10
18:30:35 a-m-z Exp $";
+ static char cvsid_hpp[] = OSGQGLWIDGET_HEADER_CVSID;
+ static char cvsid_inl[] = OSGQGLWIDGET_INLINE_CVSID;
+}
+
+#endif /* OSG_WITH_QT */
Index: Source/WindowSystem/QT4/OSGQ4GLWidget_qt.h
===================================================================
--- Source/WindowSystem/QT4/OSGQ4GLWidget_qt.h (revision 0)
+++ Source/WindowSystem/QT4/OSGQ4GLWidget_qt.h (revision 0)
@@ -0,0 +1,151 @@
+/*---------------------------------------------------------------------------*\
+ * OpenSG *
+ * *
+ * *
+ * Copyright (C) 2000-2002 by the OpenSG Forum *
+ * *
+ * www.opensg.org *
+ * *
+ * contact: [email protected], [email protected], [email protected] *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * License *
+ * *
+ * This library is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Library General Public License as published *
+ * by the Free Software Foundation, version 2. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * Changes *
+ * *
+ * *
+ * *
+ * *
+ * *
+ * *
+\*---------------------------------------------------------------------------*/
+
+#ifndef _OSG_QGLWIDGET_H_
+#define _OSG_QGLWIDGET_H_
+#ifdef __sgi
+#pragma once
+#endif
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+
+#ifdef OSG_WITH_QT
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#ifdef __sgi
+#pragma set woff 1375
+#endif
+
+#ifdef OSG_WIN32_ICL
+#pragma warning (disable : 171)
+#endif
+
+#include <QtOpenGl/QGLWidget>
+
+#ifdef OSG_WIN32_ICL
+#pragma warning (default : 171)
+#endif
+
+#ifdef __sgi
+#pragma reset woff 1375
+#endif
+
+#include "OSGConfig.h"
+#include "OSGWindowQT4Def.h"
+#include <OSGBaseTypes.h>
+
+OSG_BEGIN_NAMESPACE
+
+/*! \brief OSGQGL widget class. See \ref PageWindowQT for a description. */
+
+class OSG_WINDOWQTLIB_DLLMAPPING OSGQGLWidget : public QGLWidget
+{
+ Q_OBJECT
+
+ /*========================== PUBLIC =================================*/
+ public:
+
+ /*---------------------------------------------------------------------*/
+ /*! \name Constructors */
+ /*! \{ */
+
+ OSGQGLWidget( QWidget *parent,
+ const Char8 *name = 0,
+ const QGLWidget *shareWidget = 0,
+ Qt::WFlags f = 0);
+
+ OSGQGLWidget(const QGLFormat &format = QGLFormat::defaultFormat(),
+ QWidget *parent = 0,
+ const Char8 *name = 0,
+ const QGLWidget *shareWidget = 0,
+ Qt::WFlags f = 0);
+ /*! \} */
+ /*---------------------------------------------------------------------*/
+ /*! \name Desstructor */
+ /*! \{ */
+
+ virtual ~OSGQGLWidget();
+
+ /*! \} */
+ /*---------------------------------------------------------------------*/
+ /*! \name OpenGL handling */
+ /*! \{ */
+
+ virtual void makeCurrent(void);
+ virtual void swapBuffers(void);
+
+ /*! \} */
+ /*========================= PROTECTED ===============================*/
+ protected:
+
+ /*---------------------------------------------------------------------*/
+ /*! \name OpenGL handling */
+ /*! \{ */
+
+ virtual void initializeGL(void);
+ virtual void paintGL (void);
+ virtual void resizeGL (int w, int h);
+
+ /*! \} */
+ /*========================== PRIVATE ================================*/
+ private:
+
+ /* prohibit default function (move to 'public' if needed) */
+ OSGQGLWidget(const OSGQGLWidget &source);
+ /* prohibit default function (move to 'public' if needed) */
+ void operator =(const OSGQGLWidget &source);
+};
+
+typedef OSGQGLWidget *OSGQGLWidgetP;
+
+OSG_END_NAMESPACE
+
+#include <OSGQ4GLWidget_qt.inl>
+
+#define OSGQGLWIDGET_HEADER_CVSID "@(#)$Id: OSGQ4GLWidget_qt.h,v 1.2
2007/02/26 13:37:38 yjung Exp $"
+
+#endif /* OSG_WITH_QT */
+
+#endif /* _OSG_QGLWIDGET_H_ */
+
+
+
Index: Source/WindowSystem/QT4/OSGQ4GLWidget_qt.inl
===================================================================
--- Source/WindowSystem/QT4/OSGQ4GLWidget_qt.inl (revision 0)
+++ Source/WindowSystem/QT4/OSGQ4GLWidget_qt.inl (revision 0)
@@ -0,0 +1,52 @@
+/*---------------------------------------------------------------------------*\
+ * OpenSG *
+ * *
+ * *
+ * Copyright 2000-2002 by OpenSG Forum *
+ * *
+ * contact: [email protected], [email protected], [email protected] *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * License *
+ * *
+ * This library is free software; you can redistribute it and/or modify it *
+ * under the terms of the GNU Library General Public License as published *
+ * by the Free Software Foundation, version 2. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Library General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Library General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
+ * *
+\*---------------------------------------------------------------------------*/
+/*---------------------------------------------------------------------------*\
+ * Changes *
+ * *
+ * *
+ * *
+ * *
+ * *
+ * *
+\*---------------------------------------------------------------------------*/
+
+//---------------------------------------------------------------------------
+// Includes
+//---------------------------------------------------------------------------
+
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "OSGConfig.h"
+
+OSG_BEGIN_NAMESPACE
+
+OSG_END_NAMESPACE
+
+#define OSGQGLWIDGET_INLINE_CVSID "@(#)$Id: OSGQ4GLWidget_qt.inl,v 1.1
2006/03/10 18:30:35 a-m-z Exp $"
+
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Opensg-core mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-core