Commit 5182c7c1 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - custom GL docks now also get stored and are unified with WQtGLDockWidget.

parent 2ea2c875
......@@ -916,7 +916,11 @@ void WMainWindow::customEvent( QEvent* event )
// create new custom dock widget
widget = boost::shared_ptr< WQtCustomDockWidget >(
new WQtCustomDockWidget( title, this, ocdwEvent->getProjectionMode() ) );
addDockWidget( Qt::BottomDockWidgetArea, widget.get() );
m_glDock->addDockWidget( Qt::BottomDockWidgetArea, widget.get() );
// restore state and geometry
// TODO(ebaum): this is critical. The dock widgets get closed before saveState. This means the restored docks are closed too.
// m_glDock->restoreDockWidget( widget.get() );
// store it in CustomDockWidget list
m_customDockWidgets.insert( make_pair( title, widget ) );
......@@ -926,7 +930,6 @@ void WMainWindow::customEvent( QEvent* event )
widget = m_customDockWidgets[title];
widget->increaseUseCount();
}
//m_customDockWidgetsLock.unlock();
ocdwEvent->getFlag()->set( widget );
}
......
......@@ -30,22 +30,14 @@
#include "../../graphicsEngine/WGEViewer.h"
WQtCustomDockWidget::WQtCustomDockWidget( std::string title, QWidget* parent, WGECamera::ProjectionMode projectionMode )
: QDockWidget( QString::fromStdString( title ), parent ),
: WQtGLDockWidget( QString::fromStdString( title ), QString::fromStdString( title ), parent, projectionMode ),
m_useCount( 1 )
{
setObjectName( QString( "Custom Dock Window " ) + QString::fromStdString( title ) );
// setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
setFloating( true );
resize( 1024, 768 );
m_glWidget = boost::shared_ptr< WQtGLWidget >( new WQtGLWidget( title, this, projectionMode ) );
m_scene = new WGEGroupNode();
m_scene->setDataVariance( osg::Object::DYNAMIC );
m_glWidget->getViewer()->setScene( m_scene );
setWidget( m_glWidget.get() );
getGLWidget()->getViewer()->setScene( m_scene );
}
osg::ref_ptr< WGEGroupNode > WQtCustomDockWidget::getScene() const
......@@ -55,7 +47,7 @@ osg::ref_ptr< WGEGroupNode > WQtCustomDockWidget::getScene() const
boost::shared_ptr< WGEViewer > WQtCustomDockWidget::getViewer() const
{
return m_glWidget->getViewer();
return getGLWidget()->getViewer();
}
void WQtCustomDockWidget::increaseUseCount()
......
......@@ -30,13 +30,15 @@
#include "../../graphicsEngine/WGEGroupNode.h"
#include <QtGui/QDockWidget>
#include "WQtGLWidget.h"
#include "WQtGLDockWidget.h"
#include "../WCustomWidget.h"
/**
* Dock Widget which is created by a module to display custom information.
*/
class WQtCustomDockWidget : public QDockWidget,
class WQtCustomDockWidget : public WQtGLDockWidget,
public WCustomWidget
{
public:
......@@ -77,11 +79,6 @@ public:
protected:
private:
/**
* the included GL widget
*/
boost::shared_ptr<WQtGLWidget> m_glWidget;
/**
* the scene which is displayed by the GL widget
*/
......
......@@ -27,7 +27,8 @@
#include "WQtGLDockWidget.h"
WQtGLDockWidget::WQtGLDockWidget( QString viewTitle, QString dockTitle, QWidget* parent, const QGLWidget* shareWidget )
WQtGLDockWidget::WQtGLDockWidget( QString viewTitle, QString dockTitle, QWidget* parent, WGECamera::ProjectionMode projectionMode,
const QGLWidget* shareWidget )
: QDockWidget( dockTitle, parent )
{
setObjectName( QString( "GL - " ) + dockTitle );
......@@ -41,9 +42,9 @@ WQtGLDockWidget::WQtGLDockWidget( QString viewTitle, QString dockTitle, QWidget*
m_layout = new QVBoxLayout();
#ifndef _MSC_VER
m_glWidget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( viewTitle.toStdString(), m_panel, WGECamera::ORTHOGRAPHIC, shareWidget ) );
m_glWidget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( viewTitle.toStdString(), m_panel, projectionMode, shareWidget ) );
#else
m_glWidget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( viewTitle.toStdString(), m_panel, WGECamera::ORTHOGRAPHIC ) );
m_glWidget = boost::shared_ptr<WQtGLWidget>( new WQtGLWidget( viewTitle.toStdString(), m_panel, projectionMode ) );
#endif
setMinimumSize( 240, 240 );
......
......@@ -28,6 +28,8 @@
#include <QtGui/QDockWidget>
#include <QtGui/QVBoxLayout>
#include "../../graphicsEngine/WGECamera.h"
#include "WQtGLWidget.h"
/**
......@@ -44,9 +46,11 @@ public:
* \param viewTitle Title will be used as view title
* \param dockTitle The title of the dock widget.
* \param parent The widget that manages this widget
* \param projectionMode The projection mode used in the GL widget.
* \param shareWidget this widget will share OpenGL display lists and texture objects with shareWidget
*/
WQtGLDockWidget( QString viewTitle, QString dockTitle, QWidget* parent , const QGLWidget* shareWidget = 0 );
WQtGLDockWidget( QString viewTitle, QString dockTitle, QWidget* parent, WGECamera::ProjectionMode projectionMode = WGECamera::ORTHOGRAPHIC,
const QGLWidget* shareWidget = 0 );
/**
* destructor.
......
......@@ -30,6 +30,7 @@
#include <QtGui/QKeyEvent>
#include <QtGui/QApplication>
#include "../../graphicsEngine/WGECamera.h"
#include "../../graphicsEngine/WGEViewer.h"
#include "../../graphicsEngine/WGEScene.h"
#include "events/WPropertyChangedEvent.h"
......@@ -38,7 +39,7 @@
#include "WQtNavGLWidget.h"
WQtNavGLWidget::WQtNavGLWidget( QString viewTitle, QString dockTitle, QWidget* parent, std::string sliderTitle, const QGLWidget * shareWidget )
: WQtGLDockWidget( viewTitle, dockTitle, parent, shareWidget )
: WQtGLDockWidget( viewTitle, dockTitle, parent, WGECamera::ORTHOGRAPHIC, shareWidget )
{
propertyWidgetMap.clear();
m_sliderTitle = QString( sliderTitle.c_str() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment