A QT Widget for Ogre3d

I recently played around with integrating Ogre3d into a QT5 Application. There are various resources about integrating Ogre3d and QT on the net, but for me non of them worked out of the box with recent QT5 and Ogre3d on Linux. Therefore i decided to publish my working implementation of an Ogre3d Qt widget that works on my up to date ArchLinux with Qt 5.2 and Ogre 1.9.0. You can find the sources on github. It’s also a showcase how build QT+Ogre3d with cmake. This implementation works on Linux and Windows.

QOgreWidget.hpp/cpp contains the actual Widget implementation. It’s derived from QGLWidget and overrides some of the virtual event handler functions like paintEvent, mouseMoveEvent etc… - you have to add the events you need accordingly. For decoupling the implementation of the events from QOgreWidget, the event handler in QOgreWidget calls the actual implementation of the event handler via the injected IOgreEventHandler, so the actual implementation of the events can be kept outside the QOgreWidget.

QCameraMan.h is a modified version of the SdkCameraMan.h distributed with Ogre to be able to handle QMouseEvents (basically freepax’s cameraman.h)

QOgreWidgetDemo.hpp/cpp is shows how the QOgreWidget can be used. A screenshot of the demo can be seen below:

Example image

Update 21.03.2014: QOgreWidget does now also work on Windows (github)

comments powered by Disqus