Commit d5f8e631 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[MERGE]

parents 841d64b4 32e12e56
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <iostream> #include <iostream>
#include <QtGui/QDockWidget> #include <QtGui/QDockWidget>
#include <QtGui/QSlider>
#include <QtGui/QVBoxLayout> #include <QtGui/QVBoxLayout>
#include <QtGui/QKeyEvent> #include <QtGui/QKeyEvent>
...@@ -42,10 +41,10 @@ WQtNavGLWidget::WQtNavGLWidget( QString title, QWidget* parent, int maxValue, st ...@@ -42,10 +41,10 @@ WQtNavGLWidget::WQtNavGLWidget( QString title, QWidget* parent, int maxValue, st
setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea ); setAllowedAreas( Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea );
setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable );
QSlider *slider = new QSlider( Qt::Horizontal ); m_slider = new QSlider( Qt::Horizontal );
slider->setMaximum( maxValue ); m_slider->setMaximum( maxValue );
slider->setValue( maxValue / 2 ); m_slider->setValue( maxValue / 2 );
slider->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum ); m_slider->setSizePolicy( QSizePolicy::Minimum, QSizePolicy::Minimum );
QWidget* panel = new QWidget( this ); QWidget* panel = new QWidget( this );
QVBoxLayout* layout = new QVBoxLayout(); QVBoxLayout* layout = new QVBoxLayout();
...@@ -99,17 +98,22 @@ WQtNavGLWidget::WQtNavGLWidget( QString title, QWidget* parent, int maxValue, st ...@@ -99,17 +98,22 @@ WQtNavGLWidget::WQtNavGLWidget( QString title, QWidget* parent, int maxValue, st
} }
layout->addWidget( m_glWidget.get() ); layout->addWidget( m_glWidget.get() );
layout->addWidget( slider ); layout->addWidget( m_slider );
panel->setLayout( layout ); panel->setLayout( layout );
setWidget( panel ); setWidget( panel );
connect( slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderValueChanged( int ) ) ); connect( m_slider, SIGNAL( valueChanged( int ) ), this, SLOT( sliderValueChanged( int ) ) );
} }
WQtNavGLWidget::~WQtNavGLWidget() WQtNavGLWidget::~WQtNavGLWidget()
{ {
if( m_slider )
{
delete m_slider;
m_slider = 0;
}
} }
void WQtNavGLWidget::closeEvent( QCloseEvent* event ) void WQtNavGLWidget::closeEvent( QCloseEvent* event )
...@@ -142,5 +146,13 @@ void WQtNavGLWidget::sliderValueChanged( int value ) ...@@ -142,5 +146,13 @@ void WQtNavGLWidget::sliderValueChanged( int value )
void WQtNavGLWidget::setSliderProperty( WPropInt prop ) void WQtNavGLWidget::setSliderProperty( WPropInt prop )
{ {
m_sliderProp = prop; m_sliderProp = prop;
m_sliderProp->getCondition()->subscribeSignal( boost::bind( &WQtNavGLWidget::handleChangedPropertyValue, this ) );
} }
void WQtNavGLWidget::handleChangedPropertyValue()
{
if( m_slider )
{
m_slider->setValue( m_sliderProp->get() );
}
}
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <string> #include <string>
#include <QtGui/QDockWidget> #include <QtGui/QDockWidget>
#include <QtGui/QSlider>
#include "../../common/WPropertyVariable.h" #include "../../common/WPropertyVariable.h"
#include "../../graphicsEngine/WGEGroupNode.h" #include "../../graphicsEngine/WGEGroupNode.h"
...@@ -99,6 +100,8 @@ private: ...@@ -99,6 +100,8 @@ private:
*/ */
QString m_sliderTitle; QString m_sliderTitle;
QSlider *m_slider; //!< A pointer to the slider widget.
/** /**
* My GL widget. * My GL widget.
*/ */
...@@ -109,6 +112,11 @@ private: ...@@ -109,6 +112,11 @@ private:
*/ */
osg::ref_ptr< WGEGroupNode > m_scene; osg::ref_ptr< WGEGroupNode > m_scene;
/**
* Update slider if property changed.
*/
void handleChangedPropertyValue();
private slots: private slots:
/** /**
......
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